fix(theme): add clipboard fallback for non-HTTPS environments#11792
fix(theme): add clipboard fallback for non-HTTPS environments#11792io-ing wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Hi @io-ing! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
slorber
left a comment
There was a problem hiding this comment.
I would prefer re-introducing copy-text-to-clipboard
because it handles quirks we don't want to deal with
We could eventually lazy load it with a dynamic import so that it doesn't need to load/init for users who are using https
| return; | ||
| } | ||
|
|
||
| // Fallback for non-HTTPS environments where navigator.clipboard is unavailable |
There was a problem hiding this comment.
If this doesn't work, I'd rather revert to the former lib we were using, that handles quirks too
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
091cb1b to
65038ae
Compare
65038ae to
0e17ed4
Compare
navigator.clipboard is undefined in non-HTTPS contexts (e.g. accessing dev server via LAN IP like http://192.168.x.x:3000), which causes the copy button to throw an error since #11422 removed the copy-text-to-clipboard fallback.
This PR adds a textarea-based fallback when navigator.clipboard is unavailable.
Fixes 11791