Skip to content

Remove clipboard_button.vue's dependency on clipboard.js

What does this MR do?

Somewhat related to #329784.

This MR removes the data-clipboard-text attribute on clipboard_button.vue, and instead uses the button's click event handler to copy the value using the native Clipboard API.

Is the new API supported?

This has been tested on all supported browsers. It's not supported in Safari 13.0, but we just dropped support for that Safari version (!66231 (merged)) (it's supported in Safari 13.1).

Risk / Reward

Some quick stats:

  • No. uses of ClipboardButton: 44
  • No. parent components that this MR has modified: 2
  • No. specs modified in this MR: 4

There is a risk that we inadvertently break some of the clipboard button usages - I have not manually checked them all.

The alternative is to deprecate the current clipboard_button.vue component, create a new one that implements the new API, and swap out each one iteratively across 40+ MRs.

IMO, the approach taken in this MR strikes the appropriate balance between efficiency and quality. I am open to discussing this, though! 🙌

Screenshots or Screencasts (strongly suggested)

clipboard.js

Edited by Tom Quirk

Merge request reports