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] Fix demo code selection through copy shortcut key on Firefox browser #35670

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Dec 30, 2022

Fixes #35645

The window.getSelection() returns an empty string on Firefox browser for a text inside a form field i.e textarea due to which the check fails and copies the whole code text.
See bug opened 22 years ago which isn't yet fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=85686.

I copied the same logic as in mui/mui-x#6593 which works well.

Link to test after fix: https://deploy-preview-35670--material-ui.netlify.app/material-ui/react-menu/#main-content

The specs needs to clarify this: w3c/selection-api#83, w3c/selection-api#7

@mui-bot
Copy link

mui-bot commented Dec 30, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35670--material-ui.netlify.app/

No bundle size changes

Generated by 🚫 dangerJS against b0f53c5

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work docs Improvements or additions to the documentation browser: Firefox labels Dec 30, 2022
@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Fix demo code selection by shortcut key on Firefox browser [docs] Fix demo code selection by copy shortcut key on Firefox browser Dec 30, 2022
@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review December 30, 2022 12:29
@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Fix demo code selection by copy shortcut key on Firefox browser [docs] Fix demo code selection through copy shortcut key on Firefox browser Dec 30, 2022
@oliviertassinari oliviertassinari added scope: docs-infra Specific to the docs-infra product docs Improvements or additions to the documentation regression A bug, but worse and removed docs Improvements or additions to the documentation labels Dec 30, 2022
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good

@ZeeshanTamboli ZeeshanTamboli merged commit 11da74b into mui:master Jan 2, 2023
@ZeeshanTamboli ZeeshanTamboli deleted the issue/35645-shortcut-copy-command-not-working-on-firefox branch January 2, 2023 10:46
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
Development

Successfully merging this pull request may close these issues.

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