Close RTE dropdowns on mousedown instead of click#5926
Open
akolson wants to merge 1 commit into
Open
Conversation
ProseMirror calls preventDefault() on mouseup when repositioning the cursor, and ToolbarButton uses @mousedown.prevent — both suppress the click event per the HTML spec. Switching the document listener to mousedown makes dropdown close reliable for all interactions inside the editor. Fixes learningequality#5886 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48c8e59 to
1cc7d04
Compare
rtibblesbot
approved these changes
May 20, 2026
Contributor
rtibblesbot
left a comment
There was a problem hiding this comment.
Clean fix with a thorough root cause analysis.
CI passing. No UI files changed — visual inspection not applicable.
- praise: see inline
|
|
||
| onMounted(() => { | ||
| document.addEventListener('click', handleClickOutside); | ||
| document.addEventListener('mousedown', handleClickOutside); |
Contributor
There was a problem hiding this comment.
praise: The root cause analysis here is excellent — tracing the missing click events to two independent preventDefault() paths (ProseMirror's mouseup and ToolbarButton's @mousedown.prevent) and choosing mousedown as the fix point is well-reasoned. The change is minimal and precise.
Contributor
|
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly How was this generated?Reviewed the pull request diff checking for:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause: Two separate
preventDefault()calls suppress theclickevent inside the editor, per the HTML spec:ToolbarButton.vueuses@mousedown.preventon every toolbar button — this preventsclickfrom firing after any toolbar button presspreventDefault()onmouseupwhen repositioning the cursor — this preventsclickfrom firing when clicking into the editor content areaHow it works: Switched the document-level
handleClickOutsidelistener from'click'to'mousedown'inuseDropdowns.js(font & paste dropdowns) andEditorToolbar.vue(More overflow dropdown). Themousedownevent always propagates to the document regardless of anypreventDefault()calls, making dropdown closing reliable for all interactions.Screen.Recording.2026-05-20.at.11.09.34.mov
References
Fixes #5886
Reviewer guidance
AI usage
Implemented with Claude Code. I reviewed the generated diff and confirmed the root cause analysis (ProseMirror
mouseuppreventDefault + ToolbarButton@mousedown.preventboth suppressingclickevents).