Repository navigation
[combobox] Distinguish input-press from trigger-press in onOpenChange reason - #4015
Conversation
…tween inputPress and triggerPress
Greptile OverviewGreptile SummaryThis PR extends the Combobox Confidence Score: 3/5
Important Files Changed
|
commit: |
Additional Comments (1)
If the combobox needs different reasons depending on click target, Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/react/src/floating-ui-react/hooks/useClick.ts
Line: 1:3
Comment:
**Reason override applies globally**
`useClick` now takes a single `reason` option, but the hook typically handles both reference clicks and floating clicks (e.g. click inside popup to toggle/close). With a single global `reason`, any floating click handled by the same hook instance will report the wrong `onOpenChange` reason (e.g. `inputPress` or `triggerPress` even when the click was in the popup), which breaks the intended “triggerPress when input inside popup” behavior described in the PR.
If the combobox needs different reasons depending on click target, `useClick` likely needs to derive the reason from `event.currentTarget` (reference vs floating) or accept separate `referenceReason`/`floatingReason` options rather than a single `reason`.
How can I resolve this? If you propose a fix, please make it concise. |
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. |
…erPress condition
atomiks
left a comment
There was a problem hiding this comment.
Thanks for the fix @jijiseong!
closes #4000
Summary
onOpenChangenow receivesinput-presswhen the combobox popup is opened by the Input.Changes
input-pressto Reasons.reasonprop touseClick(defaulttriggerPress).input-pressintouseClick’sreasonprop in AriaCombobox.Question
Is it okay to keep this in useClick (configurable
reason)?