Prevent usages of navigator.clipboard
What does this MR do and why?
Prevent usages of navigator.clipboard
This change adds an eslint rule to warn contributors against using
navigator.clipboard. navigator.clipboard may not work in non-secure
environments, like a default GDK install, in most browsers.
Instead, it suggests using ~/lib/utils/copy_to_clipboard.js as an
alternative.
Why now?
While reviewing a community contribution, I learned more about the nuances of clipboard usage in browsers and found navigator.clipboard may not work in non-https environments. While this is unlikely to cause problems in production environments, our GDK install is not served via HTTPs by default so this may impact our team members and community contributors.
I opened !209139 (merged) to wrap a simple copy to clipboard method that we can use and opened this to promote its usage.
References
- Original issue: #572689 (closed)
- Method documented: !209139 (merged)
Screenshots or screen recordings
NA
How to set up and validate locally
NA
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #572689 (closed)