react-hook-clipboard
react-hook-clipboard copied to clipboard
Not supported in Firefox 97.0 / Safari / Mobile Safari
Simple to test
FireFox
navigator.permissions.query({
name: 'clipboard-read'
});
Uncaught (in promise) TypeError: 'clipboard-read' (value of 'name' member of PermissionDescriptor) is not a valid value for enumeration PermissionName.
Safari
TypeError: undefined is not an object (evaluating 'navigator.permissions.query')
The library at least handles Safari due to checking for the permissions object, but FireFox throws an exception.
MDN (see the table on https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API) and CanIUse (https://caniuse.com/permissions-api) both indicate fairly poor support for this experimental API; in fact, it is basically supported only in Chromium based browsers.
I'm not sure what the best solution is here, but some kind of fallback for non-chrome browsers would be great. If that is too much, then just indicating what browsers are supported and tested in the readme would work too.
Thank you :)
Hi @joshuapowers, thank you for reaching out.
I'm wondering if we could do something slightly smarter here. I can see that the core features (readText and writeText) have pretty decent browser support, so the issue is actually with the Permissions API. I'm thinking that it should be possible to not go through the Permissions API and handle permission checks in another way.
Would you care about taking initiative on this and opening a PR? 🙌