Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Copy w/ Shortcut (cmd + c) In Sample Code Copies Entire Code Block, Not Selected #35645

Closed
1 task done
jjorissen52 opened this issue Dec 27, 2022 · 2 comments · Fixed by #35670
Closed
1 task done
Assignees
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

Comments

@jjorissen52
Copy link

Duplicates

  • I have searched the existing issues

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

  1. Expand any sample code in the documentation site
  2. Highlight any amount of sample code
  3. cmd + c
  4. cmd + v
  5. Entire code block is pasted

Expected

  1. Only highlighted code block is pasted

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!

@jjorissen52 jjorissen52 added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Dec 27, 2022
@ZeeshanTamboli
Copy link
Member

Thanks for reporting. I can reproduce it on Firefox browser version 108.0.1 (64-bit.

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work docs Improvements or additions to the documentation browser: Firefox and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Dec 30, 2022
@ZeeshanTamboli ZeeshanTamboli self-assigned this Dec 30, 2022
@oliviertassinari oliviertassinari added scope: docs-infra Specific to the docs-infra product regression A bug, but worse labels Dec 30, 2022
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 30, 2022

It's a regression introduced with the live edit feature #34870.

I was curious, the traffic on our docs:

Screenshot 2022-12-30 at 15 13 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
3 participants