[WC-3347]: fix(combobox-web): keep filter text cleared after select-all + Backspace - #2386
[WC-3347]: fix(combobox-web): keep filter text cleared after select-all + Backspace#2386samuelreichert wants to merge 8 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
9e0e5af to
f1e2229
Compare
This comment has been minimized.
This comment has been minimized.
f1e2229 to
95cb2ae
Compare
This comment has been minimized.
This comment has been minimized.
d702c56 to
f1afa89
Compare
…-all openspec change
…-all keyboard fix
…c change Backspace/Delete on a selected chip drops keyboard focus to the document body unless the chip was the last one, because downshift only re-focuses when its own activeIndex changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e removal downshift removes the selected item but only moves DOM focus when its own activeIndex changes, which it does not for any chip other than the last. Track the chip being removed and restore focus to the item that takes its place once the removal renders, falling back to the filter input. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…moval Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
f1afa89 to
0bfd36f
Compare
AI Code Review
What was reviewed
CI checks could not be fetched (sandbox restriction). All reviewed code compiles cleanly per the tasks log ( Skipped (out of scope): Findings
|
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Reported by a customer: in a multi-select Combobox, type filter text, press Ctrl/Cmd+A, press Backspace. The input looks empty — but click outside the Combobox and back in, and the text is there again. Using Delete instead of Backspace works correctly.
Root cause.
MultiSelection.tsxlayers a customonKeyDownon top of downshift's input props, gated oninputRef.current?.selectionStart === 0:Fix. downshift already ships exactly the predicate this handler needs, and applies it to its own dropdown Backspace handling — but does not export it. Mirror it locally as
isChipNavigationPermitted: no modifier held, and either an empty input or a caret collapsed at position 0. The ArrowLeft branch carried the identical faulty check and is corrected with it. The helper carries a comment naming the downshift version and source file so a future upgrade re-checks it.What should be covered while testing?
Multi-select Combobox with at least one already-selected chip (with zero chips
setActiveIndex(-1)is a no-op and the bug never surfaces):selectedItemsStyle="boxes": ArrowLeft with a collapsed caret at position 0 reaches the chips; ArrowLeft with text selected stays in the input.