Replace clipboard.js usage with ClipboardAPI
Problem
For copying text to clipboard we’re using clipboard.js
that use document.execCommand('copy')
.
MDN says using the mention method above is discouraged, alternatively we can use Clipboard API.
clipboard.js
has a stale closed issue about using the Clipboard API, but no maintainer has dropped by.
Clipboard API is supported by the browsers that GitLab supports.
Proposal
Replace clipboard.js
usage with the new Clipboard API.
Example of using the Clipboard API: https://gitlab.com/atlas-italia/atlas-sdmx/-/blob/main/src/components/SmdXplorer/index.ts#L57