[docs] Copy w/ Shortcut (cmd + c) In Sample Code Copies Entire Code Block, Not Selected #35645
Closed
1 task done
Labels
browser: Firefox
bug 🐛
Something doesn't work
docs
Improvements or additions to the documentation
regression
A bug, but worse
scope: docs-infra
Specific to the docs-infra product
Duplicates
Related page
https://mui.com/material-ui/react-menu/
Kind of issue
Broken demonstration
Issue description
On any documentation page, if you attempt to copy a selection of code using keyboard shortcuts, instead of copying the currently highlighted block to the clipboard, the entire example code block is copied to the clipboard.
The bug appears to be present in FireFox but not Chrome. No other browsers tested. This behavior did not happen in older versions, but has been around for at least a few months.
Reproduction
Expected
Workaround
Right-click copy
It looks like some JavaScript is hijacking the event which triggers the copy action, because you can see in the top right corner the "Copy" chip changes its text to "Copied". I imagine there is some special handling in the hijacking code that only works in Chrome.
Context 🔦
I often copy little snippets of code from the example code blocks (which are fantastic!). I am able to right-click copy so that's fine, but I have accidentally copy/pasted entire example sections when I really just wanted a few lines probably about 100 times now. Not a show-stopped but a minor frustration!
The text was updated successfully, but these errors were encountered: