Repository navigation
[combobox] Fix Chips area clicks not focusing input or opening popup - #4296
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codex ReviewOverviewThis branch makes combobox chips and input-group padding clicks behave more like direct input clicks, so clicking the styled container focuses the input and can open the popup. It also keeps chip-remove presses from collapsing that flow, reuses the shared interactive-element helper in hover logic, and updates the demos to match the new interaction surface. Findings1. ℹ️ [Informational] Add a hover regression around links after the shared selector changeImpact: The hover refactor now routes both hover paths through a single interactive-element selector, so future link-related regressions will be harder to catch until that new behavior is pinned by a focused test. Evidence: Recommendation: Add a focused No blocking issues found in this patch. Confidence: 4/5High confidence based on a full Notes
|
|
With the new |
2c3f1b5 to
6c5164d
Compare
6c58ab3 to
6cbb546
Compare
Clicking anywhere in the
<Combobox.Chips>container (padding or a chip) now focuses the input and opens the popup whenopenOnInputClickis true, matching the behavior of clicking the input. Demos that use Chips usecursor: texton the container so the area looks and behaves like an input.Closes #4289.
Current behavior (before fix):
onMouseDown; the container had no handler.useClickis bound to the reference (the input). Clicks on Chips never hit that reference.Changes:
ComboboxChips.tsxdisabled,readOnly,openOnInputClick.onMouseDownhandler on the container that:readOnly.event.preventDefault()then returns whendisabled.store.state.inputRef.current?.focus(), then, ifopenOnInputClick, callsstore.state.setOpen(true, createChangeEventDetails(REASONS.inputPress, event.nativeEvent)).elementProps.onMouseDown?.(event)so consumer handlers still run.ComboboxChip.tsxonMouseDown(focus input).ComboboxChips.test.tsxfireEvent.mouseDown(chips)thenfireEvent.mouseDown(chip).