Skip to content

Commit 49c0709

Browse files
fix: collapsible toggle hover stacking issue (#7812)
1 parent 350a4a0 commit 49c0709

File tree

2 files changed

+28
-41
lines changed

2 files changed

+28
-41
lines changed

packages/ui/src/elements/Collapsible/index.scss

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
border-top-left-radius: $style-radius-m;
2020
width: 100%;
2121

22-
& > * {
23-
z-index: 1;
22+
&:hover {
23+
background: var(--theme-elevation-100);
2424
}
2525

2626
&:has(.collapsible__drag) {
@@ -31,7 +31,6 @@
3131
&__drag {
3232
display: flex;
3333
opacity: 0.5;
34-
z-index: 2;
3534
top: var(--toggle-pad-v);
3635
width: base(1.2);
3736
height: base(1.2);
@@ -56,7 +55,6 @@
5655
position: absolute;
5756
top: 0;
5857
left: 0;
59-
z-index: 1;
6058

6159
span {
6260
user-select: none;
@@ -74,9 +72,19 @@
7472
color: var(--theme-text);
7573
}
7674
}
77-
&.collapsible--hovered {
78-
> .collapsible__toggle-wrap .collapsible__toggle {
79-
background: var(--theme-elevation-100);
75+
}
76+
77+
&--style-error {
78+
border: 1px solid var(--theme-error-400);
79+
> .collapsible__toggle-wrap {
80+
background-color: var(--theme-error-100);
81+
82+
&:hover {
83+
background: var(--theme-error-150);
84+
}
85+
86+
.row-label {
87+
color: var(--theme-error-950);
8088
}
8189
}
8290
}
@@ -147,25 +155,4 @@
147155
padding: var(--gutter-h);
148156
}
149157
}
150-
151-
&--style-error {
152-
border: 1px solid var(--theme-error-400);
153-
&:hover {
154-
border: 1px solid var(--theme-error-500);
155-
}
156-
157-
> .collapsible__toggle-wrap {
158-
.row-label {
159-
color: var(--theme-error-950);
160-
}
161-
.collapsible__toggle {
162-
background: var(--theme-error-100);
163-
}
164-
}
165-
&.collapsible--hovered {
166-
> .collapsible__toggle-wrap .collapsible__toggle {
167-
background: var(--theme-error-150);
168-
}
169-
}
170-
}
171158
}

packages/ui/src/elements/Collapsible/index.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@ export const Collapsible: React.FC<Props> = ({
7272
onMouseEnter={() => setHoveringToggle(true)}
7373
onMouseLeave={() => setHoveringToggle(false)}
7474
>
75-
{dragHandleProps && (
76-
<div
77-
className={`${baseClass}__drag`}
78-
{...dragHandleProps.attributes}
79-
{...dragHandleProps.listeners}
80-
>
81-
<DragHandleIcon />
82-
</div>
83-
)}
8475
<button
8576
className={[
8677
`${baseClass}__toggle`,
@@ -93,7 +84,16 @@ export const Collapsible: React.FC<Props> = ({
9384
>
9485
<span>{t('fields:toggleBlock')}</span>
9586
</button>
96-
{header && (
87+
{dragHandleProps && (
88+
<div
89+
className={`${baseClass}__drag`}
90+
{...dragHandleProps.attributes}
91+
{...dragHandleProps.listeners}
92+
>
93+
<DragHandleIcon />
94+
</div>
95+
)}
96+
{header ? (
9797
<div
9898
className={[
9999
`${baseClass}__header-wrap`,
@@ -102,11 +102,11 @@ export const Collapsible: React.FC<Props> = ({
102102
.filter(Boolean)
103103
.join(' ')}
104104
>
105-
{header && header}
105+
{header}
106106
</div>
107-
)}
107+
) : null}
108108
<div className={`${baseClass}__actions-wrap`}>
109-
{actions && <div className={`${baseClass}__actions`}>{actions}</div>}
109+
{actions ? <div className={`${baseClass}__actions`}>{actions}</div> : null}
110110
<div className={`${baseClass}__indicator`}>
111111
<ChevronIcon direction={!isCollapsed ? 'up' : undefined} />
112112
</div>

0 commit comments

Comments
 (0)