Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CopyButton from deprecated to modern clipboard #2005

Merged
merged 1 commit into from
May 25, 2023

Conversation

cskrov
Copy link
Contributor

@cskrov cskrov commented May 25, 2023

Migrerer CopyButton til Clipboard API.

Vi opplever at CopyButton ikke alltid fungerer i Chrome.
Å migrere til Clipboard API, eller mer spesifikt writeText, fikser problemet i Chrome.

Testet OK i Chrome, Firefox og Safari på MacOS og Chrome og Firefox på Linux.

PRen fjerner også en del utdatert kode og lar window.prompt() være eneste fallback for de som bruker Internet Explorer.

  • execCommand() er deprecated.
  • Alle andre nettlesere støtter Clipboard API, spesielt writeText som CopyButton trenger. Se Can I use.

Screen recording fra Chrome som viser problemet vi opplever med CopyButton:

copybutton-issue.mov

@changeset-bot
Copy link

changeset-bot bot commented May 25, 2023

🦋 Changeset detected

Latest commit: c274026

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@navikt/ds-react Patch
@navikt/ds-react-internal Patch
aksel-icons-figma-plugin Patch
@navikt/ds-css Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/ds-css-internal Patch
@navikt/ds-codemod Patch
@navikt/aksel-icons Patch
@navikt/aksel Patch
@navikt/ds-icons Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cskrov cskrov force-pushed the modernize-copy-function branch from e11094a to c274026 Compare May 25, 2023 12:26
@github-actions
Copy link
Contributor

github-actions bot commented May 25, 2023

Endringer til review: 1

b71722af1 | 45 komponenter | 275 stories

Copy link
Collaborator

@KenAJoh KenAJoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tusen takk for fix!

@KenAJoh KenAJoh merged commit 5533fbd into main May 25, 2023
@KenAJoh KenAJoh deleted the modernize-copy-function branch May 25, 2023 12:40
@github-actions github-actions bot mentioned this pull request May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants