Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Fix comments

istarkov5946b0ef0cc3
diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
index c508ca9b79..01fa4c9622 100644
--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -308,10 +308,18 @@ export const CssValueInput = ({
shouldHandleEvent,
});
+ const menuProps = getMenuProps();
+
const handleOnBlur: KeyboardEventHandler = (event) => {
inputProps.onBlur(event);
- // When select is open, onBlur is triggered,though we don't want a change event in this case.
- if (isUnitsOpen || (isOpen && !getMenuProps().empty)) {
+ // When unit select is open, onBlur is triggered,though we don't want a change event in this case.
+ if (isUnitsOpen) {
+ return;
+ }
+
+ // If the menu is open and visible we don't want to trigger onChangeComplete
+ // as it will be done by Downshift
+ if (isOpen && !menuProps.empty) {
return;
}
@@ -320,7 +328,7 @@ export const CssValueInput = ({
const handleKeyDown = useHandleKeyDown({
// In case of menu is really open do not prevent default downshift Enter key behaviour
- ignoreEnter: isOpen && !getMenuProps().empty,
+ ignoreEnter: isOpen && !menuProps.empty,
onChangeComplete,
value,
onChange: props.onChange,
@@ -393,7 +401,7 @@ export const CssValueInput = ({
sideOffset={8}
collisionPadding={10}
>
- <ComboboxListbox {...getMenuProps()}>
+ <ComboboxListbox {...menuProps}>
{isOpen &&
items.map((item, index) => (
<ComboboxListboxItem