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 select on focus

Oleg Isonenb1bad085498a
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 fdada87030..46afe1a740 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
@@ -162,9 +162,7 @@ const useScrub = (options: {
},
});
- return () => {
- scrub.disconnectedCallback();
- };
+ return scrub.disconnectedCallback;
}, [options.value.type]);
return inputRef;
@@ -315,7 +313,8 @@ export const CssValueInput = ({
<TextField
{...inputProps}
onFocus={() => {
- inputRef.current?.select();
+ const isFocused = document.activeElement === inputRef.current;
+ if (isFocused) inputRef.current?.select();
}}
onBlur={handleOnBlur}
onKeyDown={handleKeyDown}