Skip to content

Commit 309b6a8

Browse files
authored
fix: Hovering over autocomplete ignores actual input value (#4312)
## 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
1 parent c9ce12c commit 309b6a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ export const CssValueInput = ({
368368
const defaultProps = { altKey: false, shiftKey: false };
369369

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

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

0 commit comments

Comments
 (0)