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: delay showing tooltip in toggle group (#4088)

Bogdan Chadkinff9630b07a52
diff --git a/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx b/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx
index fc3144c659..025f37a56b 100644
--- a/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx
@@ -164,7 +164,12 @@ export const ToggleGroupControl = ({
<ToggleGroupButton
aria-disabled={isAdvanced}
value={item.value}
- onMouseEnter={() => setActiveTooltip(item.value)}
+ onMouseEnter={() =>
+ // reset only when highlighted is not active
+ setActiveTooltip((prevValue) =>
+ prevValue === item.value ? prevValue : undefined
+ )
+ }
>
{item.child}
</ToggleGroupButton>
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
index 004de95f24..a1f19b6562 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
@@ -178,7 +178,12 @@ const BackgroundRepeat = (props: BackgroundContentProps) => {
>
<ToggleGroupButton
value={item.value}
- onMouseEnter={() => setActiveTooltip(item.value)}
+ onMouseEnter={() =>
+ // reset only when highlighted is not active
+ setActiveTooltip((prevValue) =>
+ prevValue === item.value ? prevValue : undefined
+ )
+ }
>
{item.child}
</ToggleGroupButton>
diff --git a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx
index ce8367eea0..1d361b09ce 100644
--- a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx
@@ -231,7 +231,12 @@ const FlexChildSectionSizing = () => {
>
<ToggleGroupButton
value={item.value}
- onMouseEnter={() => setActiveTooltip(item.value)}
+ onMouseEnter={() =>
+ // reset only when highlighted is not active
+ setActiveTooltip((prevValue) =>
+ prevValue === item.value ? prevValue : undefined
+ )
+ }
>
{item.child}
</ToggleGroupButton>
@@ -364,7 +369,12 @@ const FlexChildSectionOrder = () => {
>
<ToggleGroupButton
value={item.value}
- onMouseEnter={() => setActiveTooltip(item.value)}
+ onMouseEnter={() =>
+ // reset only when highlighted is not active
+ setActiveTooltip((prevValue) =>
+ prevValue === item.value ? prevValue : undefined
+ )
+ }
>
{item.child}
</ToggleGroupButton>