Conversation
cpruijsen
force-pushed
the
fix/issue-54
branch
from
September 15, 2026 20:06
5760c2f to
99efccb
Compare
llastflowers
requested changes
Sep 16, 2026
llastflowers
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this fix! Before we can merge this we need to:
- Preserve
option.click()with a guardedclicklistener (as mentioned in PR description) - Add a direct
option.click()regression test - Remove the new direct
fireCommitEvent(target)call from the keyboard path: Lettarget.click()reach theclicklistener as it previously did, preserving the existing event order anddetail.eventvalue - Ensure the guard resets when a
mousedownis not followed by a click
mousedown commits the option; the click that follows is skipped so one mouse selection fires one combobox-commit. A click with no preceding mousedown, such as option.click(), still commits, which is also how Enter and Tab commit again. The guard holds the committed option and is cleared by the next click anywhere in the document, so a mousedown the pointer never completed cannot swallow a later click.
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
The list listens on
mousedownand onclick.mousedowncommits, and the click that follows it is skipped, so one mouse selection fires onecombobox-commitand ablurhandler that callsstop()no longer loses it (mousedownruns beforeblur;stop()removed the oldclicklistener). A click with no precedingmousedown, such asoption.click(), still commits, so the keyboard path is unchanged:commit()callstarget.click()and the click listener fires the event with the click indetail.event. Non-primary buttons are ignored, matchingclick.The guard holds the option the
mousedowncommitted and is cleared by the next click anywhere in the document, so a press the pointer never completed cannot swallow a later click on that option.For a mouse selection
detail.eventis now themousedownevent rather than theclick. That follows from committing onmousedown.Fixes #54.
Decision
The library listens on
mousedown(the approach in #54) rather than leaving commit onclickand adding aninteractingWithListflag in the example, as github/auto-complete-element and github/text-expander-element do for this race. Closing the list on input blur is normal. Binding commit toclickalone makes every such consumer lose the mouse path; the demo was the reproduction.Test plan
mousedown->blur/stop()->clickstill fires onecombobox-commit.option.click()fires onecombobox-commit.mousedownwhose click lands elsewhere does not suppress a lateroption.click().click-only listener; passes withmousedownplus the guardedclick.<a>options updatinglocation.hash.npm test(eslint,tsc, Karma/Chrome Headless): 27 tests completed.