-
Notifications
You must be signed in to change notification settings - Fork 357
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
navigator.clipboard is ONLY available in secure contexts (HTTPS) #9013
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Any news on this? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Don't you dare stale-bot! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Hello @jkilzi, since there are some downsides with We could potentially add a fallback or optional prop to use that older API, but since If I'm understanding things correctly you can specify an alternative copy function like that using our |
IMHO you still need a polyfill, unless PatternFly can only be used with the same browsers that support the Clipboard API (if that's the case stop reading and close the issue 😉). |
The clipboard API has been supported in all of our supported browsers since 2020. That doesn't mean we won't at least consider adding a polyfill since, as you've pointed out, non secure contexts could still be an issue. To be totally honest though I would be quite surprised if teams are deploying new production sites without HTTPS. I would say I'm still leaning away from including it in PF unless there's an approach which doesn't require using deprecated browser behavior, but I'll bring all of this to the team at our standup today and let you know where we land.
If we elect to not add a polyfill I would definitely be on board with us adding some documentation (potentially a warning in the console?) or something to help consumers know how to proceed.
Also I believe that the |
My apologies, I double checked the I must say, why would PF allow the dev/user to implement the "low-level" copy to clipboard function themselves? It is like allowing the driver to mess with the engine when all they want is just to drive... Anyway, IMO I wouldn't expose the |
The team feels that since the polyfill requires deprecated browser functionality it would be best to leave implementations of it consumer side with the
For situations just like this actually, if a consumer needs to support browsers outside of the PF support window, or just generally handle the clipboard copying in a way that we don't, the prop allows that flexibility.
I think replacing the |
I believe you meant
Sure, I'll do with pleasure, if time allows me... 😉 |
Yes, While we guarantee support for the latest browsers that of course doesn't explicitly mean that we won't consider changes to support non-latest browsers, but we do have to weigh the pros and cons of such changes. If the clipboard API wasn't available on Chrome last month it would've been a very different decision than it being available for the last 4-6 years. |
Ref: https://github.com/patternfly/patternfly-react/blob/ce1afc78845fba2fd75a62f3ed440b289b4d5b56/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx#LL14C1-L14C1
Therefore the
clipboardCopyFunc
can only be used in secured contexts. The code above doesn't work for pages served under HTTP for instance. (Bear in mind that this works properly for pages served locally under HTTP, e.g. http://localhost/...).Please check out this article for more info.
The text was updated successfully, but these errors were encountered: