CodeMirror swallows onClick event #3145
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CodeMirror's parenthesis match mechanism swallows the event on the first click when user clicks on a matching parenthesis.
For example, if I have a listener on the CodeMirror element:
Then if the editor displays code with parenthesis:
If I click on line 1, codemirror will highlight the matched parenthesis on line 3, which is expected. However, it will also swallow the click event, and the listener wouldn't fire.
It has to. To prevent the default mouse behavior, CodeMirror must
preventDefaultmousedownevents, which will prevent"click"from happening. Listen tomousedownormouseupinstead.Thanks for the quick response! Can you provide a little more detail regarding why "it has to"? i.e. what behavior is it trying to prevent?
We don't want clicking to steal focus from the hidden textarea, and we don't want dragging to create a DOM selection.