diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx index 81ee3c9d3d98..28f2820e77a9 100644 --- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx +++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx @@ -39,7 +39,6 @@ import { import { useUnitSelect } from "./unit-select"; import { parseIntermediateOrInvalidValue } from "./parse-intermediate-or-invalid-value"; import { toValue } from "@webstudio-is/css-engine"; -import { useDebouncedCallback } from "use-debounce"; import { declarationDescriptions, isValidDeclaration, @@ -656,16 +655,6 @@ export const CssValueInput = ({ const menuProps = getMenuProps(); - /** - * useDebouncedCallback without wait param uses Request Animation Frame - * here we wait for 1 tick until the "blur" event will be completed by Downshift - **/ - const callOnCompleteIfIntermediateValueExists = useDebouncedCallback(() => { - if (props.intermediateValue !== undefined) { - onChangeComplete({ value, type: "blur" }); - } - }); - const handleOnBlur: KeyboardEventHandler = (event) => { inputProps.onBlur(event); // When unit select is open, onBlur is triggered,though we don't want a change event in this case. @@ -675,10 +664,7 @@ export const CssValueInput = ({ // If the menu is open and visible we don't want to trigger onChangeComplete // as it will be done by Downshift - // There is situation that Downshift will not call omCompleted if nothing is selected in menu if (isOpen && menuProps.empty === false) { - // There is a situation that Downshift will not call onChangeComplete if nothing is selected in the menu - callOnCompleteIfIntermediateValueExists(); return; } @@ -745,6 +731,8 @@ export const CssValueInput = ({ valueForDescription )}` as keyof typeof declarationDescriptions; description = declarationDescriptions[key]; + } else if (highlightedValue?.type === "var") { + description = "CSS custom property (variable)"; } const descriptions = items @@ -894,11 +882,10 @@ export const CssValueInput = ({ ))} - {description && ( - - {description} - - )} + + + {description} + )} diff --git a/packages/design-system/src/components/combobox.tsx b/packages/design-system/src/components/combobox.tsx index ae5b3aff3e61..806b484bed04 100644 --- a/packages/design-system/src/components/combobox.tsx +++ b/packages/design-system/src/components/combobox.tsx @@ -287,6 +287,15 @@ export const useCombobox = ({ onIsOpenChange(state) { const { type, isOpen, inputValue } = state; + // Tab from the input with menu opened should reset the input value if nothing is selected + if (type === comboboxStateChangeTypes.InputBlur) { + onChange?.(undefined); + // If the input is blurred, we want to close the menu and reset the value to the selected item. + setIsOpen(false); + setMatchedItems([]); + return; + } + // Don't open the combobox if the input is a number and the user is using the arrow keys. // This prevents the combobox from opening when the user is trying to increment or decrement a number. if (