fix(combobox): open panel on chevron click (x-combobox + x-multi-combobox)#268
Merged
Merged
Conversation
The chevron in x-combobox and x-multi-combobox carries a `pointerdown` listener that toggles the panel, but its CSS set `pointer-events:none`, so real clicks fell straight through and the handler was dead code. Clicking the arrow was a no-op; only the input area opened the panel. Remove `pointer-events:none` from the `[part=chevron]` rule (and add `cursor:pointer` for affordance) in both components. The handler, preventDefault, and open/close toggle were already correct. These are the only two affected components: elsewhere the chevron either sits inside a <button>/native <select> that handles the click, or the pointer-events:none is on a decorative arrow/disabled state. Adds regression tests asserting the chevron's computed pointer-events is not "none" (a synthetic dispatchEvent bypasses hit-testing, so the computed style is what actually guards the bug) plus a pointerdown toggle test. Fixes avanelsas#267 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
@markaddleman thanks for finding and fixing this! Approved and merged |
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.
Problem
Clicking the dropdown arrow (chevron) on
x-multi-combobox(andx-combobox) is a no-op. Users expect it to open the panel, just like clicking the input area does.Fixes #267.
Root cause
The chevron already has a
pointerdownlistener wired up that toggles the panel:…but the chevron's CSS set
pointer-events:none, so the chevron was never the target of apointerdown— pointer events passed straight through it and the handler was dead code. The pointer fell through to the wrapper, which has no handler, so nothing happened. Clicking "to the left" worked only because that region is the actual<input>, whose nativefocusevent opens the panel.Fix
Remove
pointer-events:nonefrom the[part=chevron]rule in both components, and addcursor:pointerfor affordance. The handler,preventDefault, and open/close toggle were already correct — they just needed the chevron to be hit-testable.Scope
I audited every chevron/arrow/trigger-bearing component. These two are the only ones affected: in both, the chevron carries its own click handler while the rest of the control is a text input (no parent button to catch a fall-through click). Everywhere else (
x-dropdown,x-date-picker,x-select,x-popover,x-tooltip, …) the chevron either sits inside a<button>/native<select>that handles the click, orpointer-events:noneis on a decorative arrow triangle or a disabled state — all correct.Tests
Added two regression tests per component:
chevron-is-hit-testable-test— asserts the chevron's computedpointer-eventsis not"none". This is the test that actually guards the bug: a syntheticdispatchEventbypasses CSS hit-testing, so only the computed style catches it.chevron-pointerdown-toggles-open-test— documents the handler contract (open on first pointerdown, close on second).Full suite: 5100 tests pass headless (
npm test); clj-kondo clean.🤖 Generated with Claude Code