Skip to content

Commit e99f30e

Browse files
committed
Stop hover transfer working between rows of Properties panel dropdown menus
1 parent 2d6d054 commit e99f30e

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

frontend/src/components/layout/FloatingMenu.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@
372372
// Start with the parent of the spawner for this floating menu and keep widening the search for any other valid spawners that are hover-transferrable
373373
let currentAncestor = (targetSpawner && ownSpawner?.parentElement) || undefined;
374374
while (currentAncestor) {
375+
// If the current ancestor blocks hover transfer, stop searching
376+
if (currentAncestor.hasAttribute("data-block-hover-transfer")) break;
377+
375378
const ownSpawnerDepthFromCurrentAncestor = ownSpawner && getDepthFromAncestor(ownSpawner, currentAncestor);
376379
const currentAncestor2 = currentAncestor; // This duplicate variable avoids an ESLint warning
377380
@@ -382,8 +385,8 @@
382385
const notOurself = !ownDescendantMenuSpawners.includes(item);
383386
// And filter away unequal depths from the current ancestor
384387
const notUnequalDepths = notOurself && getDepthFromAncestor(item, currentAncestor2) === ownSpawnerDepthFromCurrentAncestor;
385-
// And filter away elements that explicitly disable hover transfer
386-
return notUnequalDepths && !(item as HTMLElement).getAttribute?.("data-floating-menu-spawner")?.includes("no-hover-transfer");
388+
// And filter away descendants that explicitly disable hover transfer
389+
return notUnequalDepths && !(item instanceof HTMLElement && item.hasAttribute("data-block-hover-transfer"));
387390
});
388391
389392
// If none were found, widen the search by a level and keep trying (or stop looping if the root was reached)

frontend/src/components/widgets/WidgetSection.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
/>
6060
</button>
6161
{#if expanded}
62-
<LayoutCol class="body">
62+
<LayoutCol class="body" data-block-hover-transfer>
6363
{#each widgetData.layout as layoutGroup}
6464
{#if isWidgetSpanRow(layoutGroup)}
6565
<WidgetSpan widgetData={layoutGroup} {layoutTarget} />

frontend/src/components/widgets/buttons/TextButton.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
data-disabled={disabled || undefined}
7373
data-text-button
7474
tabindex={disabled ? -1 : 0}
75-
data-floating-menu-spawner={menuListChildrenExists ? "" : "no-hover-transfer"}
75+
data-floating-menu-spawner
76+
data-block-hover-transfer={menuListChildrenExists ? undefined : ""}
7677
on:click={onClick}
7778
>
7879
{#if icon}

frontend/src/components/widgets/inputs/WorkingColorsInput.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<LayoutCol class="working-colors-button">
3939
<LayoutRow class="primary swatch">
40-
<button on:click={clickPrimarySwatch} class:open={primaryOpen} style:--swatch-color={primary.toRgbaCSS()} data-floating-menu-spawner="no-hover-transfer" tabindex="0"></button>
40+
<button on:click={clickPrimarySwatch} class:open={primaryOpen} style:--swatch-color={primary.toRgbaCSS()} data-floating-menu-spawner data-block-hover-transfer tabindex="0"></button>
4141
<ColorPicker
4242
open={primaryOpen}
4343
on:open={({ detail }) => (primaryOpen = detail)}
@@ -47,7 +47,7 @@
4747
/>
4848
</LayoutRow>
4949
<LayoutRow class="secondary swatch">
50-
<button on:click={clickSecondarySwatch} class:open={secondaryOpen} style:--swatch-color={secondary.toRgbaCSS()} data-floating-menu-spawner="no-hover-transfer" tabindex="0"></button>
50+
<button on:click={clickSecondarySwatch} class:open={secondaryOpen} style:--swatch-color={secondary.toRgbaCSS()} data-floating-menu-spawner data-block-hover-transfer tabindex="0"></button>
5151
<ColorPicker
5252
open={secondaryOpen}
5353
on:open={({ detail }) => (secondaryOpen = detail)}

0 commit comments

Comments
 (0)