feat: add autoFocusPartialMatch to combo boxes - #12438
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e959494 to
6153891
Compare
Value commit for a focused item is already covered by other suites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The focused-index behavior they cover is generic and already tested in keyboard.test.js. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a7430cf to
49e5e85
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Align with the agreed Flow API: setAutoFocusPartialMatch with NONE, FIRST_MATCH, and ONLY_MATCH values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35b16c4 to
a67e298
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a67e298 to
9890206
Compare
The example lives in the PR description instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 5 comments.
| Finding | |
|---|---|
| In multi-select-combo-box, pressing Enter on an auto-focused partial match that is already selected removes it instead of adding a selection. | |
With first-match, Escape needs two presses to close the dropdown after typing a partial filter. |
|
| 🧹 | New multi-select test duplicates shared mixin behavior instead of testing it once in the mixin's package. |
| 👀 | Shared property docstring says the partial match is committed on blur, which is false for multi-select-combo-box. |
| 🧹 | !items || items.length === 0 can be written as !items?.length. |
Mirrors the autoFocusPartialMatch property added to the web components in vaadin/web-components#12438. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
web-padawan
left a comment
There was a problem hiding this comment.
Question: how should this work together with autoOpenDisabled? When typing partial value and pressing Enter while overlay is closed, first-match commits it. This is probably acceptable, but IMO it should be documented - currently, JSDoc only mentions an item highlighter in the dropdown while typing.
|
🤖 AI-generated Adversarial Review: feat: add autoFocusPartialMatch to combo boxesThe mechanism is minimal and the default path is provably unchanged, which is the right shape for this feature. My concern is that the 🟠 MediumEnter submits the surrounding form when combined with Building on @web-padawan's Verified inside a
The "valid value → Enter submits" contract is pre-existing (an exact-match filter behaves this way today), so this is a widening rather than a new bug. But the motivating use case in #1280 is users filling long forms: one keystroke now replaces their typed text with an item they never saw and submits the form. Worth deciding explicitly, not just documenting. Typing a prefix of the already-selected item replaces the selection With
Exact-match precedence does not help here, since 🟡 Low / NitpicksNo observer, so the property is stale while a filter is active
Unknown values silently disable the feature A typo such as Coverage asymmetry between the two modes
✅ What is done well
Summary: Not mergeable as-is, but the blocker is already on the thread — of my new findings, the |
Committing on Enter toggles the focused item, and the existing guard only covered typing the exact label. With autoFocusPartialMatch, an already selected partial match got silently unselected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each mode is now tested against Enter, outside click, and item click. Also replace the private _focusedIndex assertion with a commit-based test per review feedback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Multi-select combo box never commits the focused item on blur or outside click, so the shared docstring only mentions Enter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With autoOpenDisabled, typing a partial value and pressing Enter committed an item that was never shown. The partial match is now focused only while the dropdown is open, and gets focused once the dropdown is opened after typing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Test commit gestures extensively for the exact match and first-match mode, keep only-match Enter-only, and drop item click tests since the feature does not affect item click behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
06e4d78 to
7572c9f
Compare
In Firefox, Tab does not move focus out of the input unless the page has another focusable element, so the blur commit never ran. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|



Typing a filter and committing it with Tab, Enter, or an outside click only selects an item when the input text matches an item label exactly. Users filling long forms want to type a partial filter and commit it without pressing Arrow Down first (#1280), or have the only remaining item selected automatically (#9636).
This adds an opt-in
autoFocusPartialMatchproperty (none|first-match|only-match, defaultnone) to combo-box and multi-select-combo-box. Withfirst-match, the first item in the filtered results is focused; withonly-match, the item is focused when filtering narrows the results to a single item.The focused item is highlighted in the dropdown while typing and is committed through the existing commit paths, so Enter, Tab, blur, and outside click all work. In multi-select-combo-box the selection happens on Enter or item click, since that component intentionally never commits on blur.
An exact label match is always focused regardless of the property, and partial matches are not focused when
allowCustomValueis enabled. A partial match is also only focused while the dropdown is open: withautoOpenDisabled, typing alone does not focus or commit a match, and the match is focused once the user opens the dropdown.Example for manual testing
Part of #1280