Skip to content

Commit

Permalink
fix: Hovering over autocomplete ignores actual input value (#4312)
Browse files Browse the repository at this point in the history
## Description

closes #4301
closes #4308

## 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 c9ce12c commit 309b6a8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ export const CssValueInput = ({
const defaultProps = { altKey: false, shiftKey: false };

if (value.type !== "intermediate" && value.type !== "invalid") {
// The value might be valid but not selected from the combo menu. Close the menu.
closeMenu();
props.onChangeComplete({ ...defaultProps, ...event, value });
return;
}
Expand All @@ -379,6 +381,8 @@ export const CssValueInput = ({
return;
}

// The value might be valid but not selected from the combo menu. Close the menu.
closeMenu();
props.onChangeComplete({
...defaultProps,
...event,
Expand All @@ -395,6 +399,7 @@ export const CssValueInput = ({
getItemProps,
isOpen,
highlightedIndex,
closeMenu,
} = useCombobox<CssValueInputValue>({
// Used for description to match the item when nothing is highlighted yet and value is still in non keyword mode
getItems: getOptions,
Expand Down

0 comments on commit 309b6a8

Please sign in to comment.