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

Selection loss when dragging mouse over mention nodes in Firefox #743

Open
canibanoglu opened this issue Nov 27, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@canibanoglu
Copy link

Describe the bug
When using the mouse to select a range, as soon as the mouse goes over a mention node, the selection is reset. This only happens in Firefox, Chrome and Safari seems to work OK. Haven't tested on IE/Edge.

To Reproduce
Steps to reproduce the behavior:
0. Use Firefox

  1. Go to the demo page
  2. Start selecting text with the mouse
  3. The selection will be gone as soon as the mouse touches a mention node.

Expected behavior
The selection should not be lost.

Desktop (please complete the following information):

  • OS: OS X Sonoma 14.1
  • Browser Firefox
  • Version 133.0

Additional context
While we are not using lexical-beautiful-mentions we have a node that was heavily inspired by the MentionNode and I thought I'd check out if the issue is also present in this repo and it turns out that it is.

Moreover, I have found a solution for this and am happy to create a PR for it if it's also agreeable to you. We ended up adding the following CSS rules to our node:

user-select: all;
-moz-user-select: none;

I have stumbled on this while reading lexical playground's source and saw this comment. Thought I'd give it a try with user-select and it seems to work just fine.

Copy link

dosubot bot commented Nov 27, 2024

@canibanoglu Greetings! I'm here to assist you with any bugs, questions, or contributions. Let me know how I can help you.

The issue you're experiencing with selection loss in Firefox when dragging the mouse over mention nodes is indeed a known problem. It seems to be specific to Firefox, as you've noted that Chrome and Safari do not exhibit this behavior. The solution you've proposed, using the CSS rules user-select: all; and -moz-user-select: none;, is a clever workaround that addresses the issue by ensuring that the mention nodes are selectable in a way that Firefox handles correctly.

If you're considering contributing this fix to the lexical-beautiful-mentions repository, it could be beneficial for others facing the same issue. Your approach aligns with similar solutions seen in other projects, like the Lexical Playground, which suggests that this is a reasonable and effective fix.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label Nov 27, 2024
@sodenn
Copy link
Owner

sodenn commented Nov 30, 2024

Thanks for reporting this issue and sharing your solution!. Feel free to open a PR — I’ll be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants