fix(composer): Enter defers to an open mention/slash combobox (LC-171) #216
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-171-composer-enter-guard"
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?
Closes LC-171. Raised in the LC-168 review: could Enter, with a composer combobox popover open, both submit the form AND insert the highlighted option?
Resolution
No browser in the dev env, but the question is decidable by the DOM event model. There are three Enter-handling keydown listeners, all on the same textarea:
onkeydown(submits viarequestSubmit()), registered at parse time;addEventListener(..., true)), registered later;addEventListener(..., true)), registered later still.At the target element, listeners fire in registration order regardless of the capture flag, and
stopPropagation()(what the comboboxes call) does not stop other listeners on the same target - onlystopImmediatePropagation()does. So the inline handler runs first and callsrequestSubmit()with the partial text (e.g.@ali) before the combobox inserts the resolved option, whichhx-on::after-requestthen wipes. The double-fire is real per spec; the visible symptom is a broken half-typed send.Fix
The inline handler short-circuits before submitting when an
aria-selectedoption exists in either popover (#lc-mention-popover/#lc-slash-popover):Properties:
preventDefaults the Enter.Test
A regression test in
routes_drafts.rsrenders the composer and asserts both that the guard selector is present and that it precedesrequestSubmit()in the markup, since the ordering of the short-circuit is what makes it correct.Verification
just test/just test-saas: all binaries green except the knownroutes_uploadsconcurrent-load flake (documented in CLAUDE.md), which passes 12/12 in isolation in both modes. This change touches onlyroom/composer.htmland the drafts test - nothing upload-related.cargo clippy/cargo fmtclean.