Loading
Migrate navigator.clipboard in code block bubble menu to copyToClipboard
What does this MR do and why?
The code block bubble menu copy button called navigator.clipboard.writeText directly, which fails in non-secure contexts.
This follows the work in !211222 (merged), which blocks direct use of navigator.clipboard. The component now uses the shared helper copyToClipboard from ~/lib/utils/copy_to_clipboard and the matching eslint-disable comment is removed. The spec now mocks copyToClipboard instead of spying on navigator.clipboard.
Closes #579481.
References
Part of epic &19827.
Screenshots or screen recordings
Not applicable — no visual change.
How to set up and validate locally
- Run
yarn jest spec/frontend/content_editor/components/bubble_menus/code_block_bubble_menu_spec.js.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.