codemirror-interact
codemirror-interact copied to clipboard
Unexpected Cursor Behavior
Greetings! I was trying this out and noticed that the "ew-resize" cursor does not appear when you hover over numbers. FWIW I'm using Chrome Version 103.0.5060.134 on Ubuntu Linux 22.04 LTS.
To reproduce: try this demo https://replit.com/@util/codemirror-interact
- Hold Alt, hover over a number, drag it
- Note that the cursor does not change
Also uploading this screen capture:
Screencast from 09-02-2022 03:17:37 PM.webm
I wonder if some part of the CodeMirror API may have changed since this was originally created?
Thanks for the cool inspiring project!
weird. @slmjkdbtl mind taking a look?
I think I ran into this too sometimes, will check
Thanks!
I poked around a little more and discovered a few more things. The buggy behavior depends on where the mouse cursor is when the Alt key is pressed and un-pressed.
- If you first move the mouse to be inside the CodeMirror rectangle, then hit Alt, it works as expected.
- If the Alt key is un-pressed while inside the CodeMirror rectangle and not on top of an interactive element (like a number), everything works fine.
- If the Alt key is un-pressed while inside the CodeMirror rectangle and on top of an interactive element (like a number), the cursor for the interactive elements does not get reset back to the normal cursor.
- If the Alt key is un-pressed while outside the CodeMirror rectangle, the cursor seeme to get stuck on the cross cursor when you do hit Alt again.
The solution may lie in handling all possible cases of Alt being up or down when mouseenter and mouseout are fired on the overall CodeMirror instance and also on the interactive element.
- CodeMirror Rectangle: Mouseenter + Alt already pressed
- CodeMirror Rectangle: Mouseenter + Alt not already pressed
- CodeMirror Rectangle: Mouseout + Alt already pressed
- CodeMirror Rectangle: Mouseout + Alt not already pressed
- Interactive element: Mouseenter + Alt already pressed
- Interactive element: Mouseenter + Alt not already pressed
- Interactive element: Mouseout + Alt already pressed
- Interactive element: Mouseout + Alt not already pressed