Skip to content

Commit

Permalink
fix: Сombobox if the menu is opened using the up or down arrows, we w…
Browse files Browse the repository at this point in the history
…ant 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
  • Loading branch information
istarkov authored Oct 19, 2024
1 parent 6939a99 commit c9ce12c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/design-system/src/components/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ export const useCombobox = <Item,>({
return;
}

// If the menu is opened using the up or down arrows, we want to display all items without applying any filters.
if (
isOpen &&
(type === comboboxStateChangeTypes.InputKeyDownArrowDown ||
type === comboboxStateChangeTypes.InputKeyDownArrowUp)
) {
const matchedItems = getItems();
setMatchedItems(matchedItems);
setIsOpen(matchedItems.length > 0);

return;
}

if (isOpen) {
itemsCache.current = getItems();
const matchedItems = match(
Expand Down

0 comments on commit c9ce12c

Please sign in to comment.