Skip to content

Commit c9ce12c

Browse files
authored
fix: Сombobox if the menu is opened using the up or down arrows, we want to display all items without applying any filters (#4311)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 6939a99 commit c9ce12c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/design-system/src/components/combobox.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,19 @@ export const useCombobox = <Item,>({
298298
return;
299299
}
300300

301+
// If the menu is opened using the up or down arrows, we want to display all items without applying any filters.
302+
if (
303+
isOpen &&
304+
(type === comboboxStateChangeTypes.InputKeyDownArrowDown ||
305+
type === comboboxStateChangeTypes.InputKeyDownArrowUp)
306+
) {
307+
const matchedItems = getItems();
308+
setMatchedItems(matchedItems);
309+
setIsOpen(matchedItems.length > 0);
310+
311+
return;
312+
}
313+
301314
if (isOpen) {
302315
itemsCache.current = getItems();
303316
const matchedItems = match(

0 commit comments

Comments
 (0)