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

Fix: Add fallback for clipboard.writeText #7314

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

heybran
Copy link
Contributor

@heybran heybran commented Jun 21, 2024

Description

Copy button near field name previously was using navigator.clipboard.writeText, but I just found out that the API is only available for secure context: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText

So if developers are working locally on insecure context, copy button will fail. I believe I was working with https when I was adding this feature back then, so I didn't really catch the bug.

So I'm sending a fix PR to add a fallback to insecure context or old browsers.

Related GitHub issue(s)

#7237

Testing instructions

  1. Spin up a local site without https
  2. Find the copy button
  3. Click the button, now the field name will be copied.

Screenshots / screencast

Changelog text for these changes

Bug: Copy button now works correctly in secure context. #7237 (@heybran)

PR checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant