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.

position picker popover next to the style panel without margin

Oleg Isonen403c5bedeccf
diff --git a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
index 9fecafec57..0195cfadd7 100644
--- a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx
@@ -12,8 +12,9 @@ const usePickerSideOffset = (
isOpen: boolean
): [MutableRefObject<HTMLButtonElement | null>, number] => {
const ref = useRef<HTMLButtonElement | null>(null);
+ // Hack - depends on a relative position of a parent container to calculate the offset.
const sideOffset =
- isOpen && ref.current !== null ? PANEL_WIDTH - ref.current.offsetWidth : 0;
+ isOpen && ref.current !== null ? ref.current.offsetLeft : 0;
return [ref, sideOffset];
};
diff --git a/apps/designer/app/designer/features/style-panel/style-panel.tsx b/apps/designer/app/designer/features/style-panel/style-panel.tsx
index 1e36ab7d72..cad204889a 100644
--- a/apps/designer/app/designer/features/style-panel/style-panel.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-panel.tsx
@@ -65,7 +65,13 @@ export const StylePanel = ({
}}
/>
</Box>
- <Box css={{ overflow: "auto" }}>
+
+ <Box
+ css={{
+ overflow: "auto",
+ position: "relative", // Hack - value picker popover positioning depends on it
+ }}
+ >
<StyleSettings
search={search}
selectedInstanceData={selectedInstanceData}