material-ui
material-ui copied to clipboard
[Menu] On Firefox, selection gets removed after a right-click on selected text to open the context menu
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Current behavior 😯
With Firefox [v102.0 (64-bit)] and Material UI's context menu combination, when I select the text and perform a right-click on the selected text, it triggers a context, but it just clears out the text selection. It is reproducible on the Material UI's official site as well.
Expected behavior 🤔
When I select the text and perform a right-click on the selected text, it should open the context menu keeping the user text selection as is.
Steps to reproduce 🕹
Steps:
- Open the Firefox browser.
- Go to the Material UI's official site that demonstrates context menu implementation.
- Select some random text and perform right click on it.

Context 🔦
I am trying to implement a context menu in my project which already has a material UI dependency.
Your environment 🌎
No response
I believe this behavior is inherent to Firefox - whenever another element is focused, the selection is lost. This isn't specific to Material UI. Proof: https://jsbin.com/jovakuyimu/1/edit?html,js,output
Any workaround for this? Material UI should support Firefox out of the box.
We do support Firefox. As I stated above, this issue is not specific to Material UI. We can't control Firefox's internal behavior. I'm not aware of any workarounds for this.