fix: collapsible toggle hover stacking issue (#7812)

This commit is contained in:
Jarrod Flesch
2024-08-23 08:51:10 -04:00
committed by GitHub
parent 350a4a0718
commit 49c0709fed
2 changed files with 28 additions and 41 deletions

View File

@@ -19,8 +19,8 @@
border-top-left-radius: $style-radius-m; border-top-left-radius: $style-radius-m;
width: 100%; width: 100%;
& > * { &:hover {
z-index: 1; background: var(--theme-elevation-100);
} }
&:has(.collapsible__drag) { &:has(.collapsible__drag) {
@@ -31,7 +31,6 @@
&__drag { &__drag {
display: flex; display: flex;
opacity: 0.5; opacity: 0.5;
z-index: 2;
top: var(--toggle-pad-v); top: var(--toggle-pad-v);
width: base(1.2); width: base(1.2);
height: base(1.2); height: base(1.2);
@@ -56,7 +55,6 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1;
span { span {
user-select: none; user-select: none;
@@ -74,9 +72,19 @@
color: var(--theme-text); color: var(--theme-text);
} }
} }
&.collapsible--hovered { }
> .collapsible__toggle-wrap .collapsible__toggle {
background: var(--theme-elevation-100); &--style-error {
border: 1px solid var(--theme-error-400);
> .collapsible__toggle-wrap {
background-color: var(--theme-error-100);
&:hover {
background: var(--theme-error-150);
}
.row-label {
color: var(--theme-error-950);
} }
} }
} }
@@ -147,25 +155,4 @@
padding: var(--gutter-h); padding: var(--gutter-h);
} }
} }
&--style-error {
border: 1px solid var(--theme-error-400);
&:hover {
border: 1px solid var(--theme-error-500);
}
> .collapsible__toggle-wrap {
.row-label {
color: var(--theme-error-950);
}
.collapsible__toggle {
background: var(--theme-error-100);
}
}
&.collapsible--hovered {
> .collapsible__toggle-wrap .collapsible__toggle {
background: var(--theme-error-150);
}
}
}
} }

View File

@@ -72,15 +72,6 @@ export const Collapsible: React.FC<Props> = ({
onMouseEnter={() => setHoveringToggle(true)} onMouseEnter={() => setHoveringToggle(true)}
onMouseLeave={() => setHoveringToggle(false)} onMouseLeave={() => setHoveringToggle(false)}
> >
{dragHandleProps && (
<div
className={`${baseClass}__drag`}
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
>
<DragHandleIcon />
</div>
)}
<button <button
className={[ className={[
`${baseClass}__toggle`, `${baseClass}__toggle`,
@@ -93,7 +84,16 @@ export const Collapsible: React.FC<Props> = ({
> >
<span>{t('fields:toggleBlock')}</span> <span>{t('fields:toggleBlock')}</span>
</button> </button>
{header && ( {dragHandleProps && (
<div
className={`${baseClass}__drag`}
{...dragHandleProps.attributes}
{...dragHandleProps.listeners}
>
<DragHandleIcon />
</div>
)}
{header ? (
<div <div
className={[ className={[
`${baseClass}__header-wrap`, `${baseClass}__header-wrap`,
@@ -102,11 +102,11 @@ export const Collapsible: React.FC<Props> = ({
.filter(Boolean) .filter(Boolean)
.join(' ')} .join(' ')}
> >
{header && header} {header}
</div> </div>
)} ) : null}
<div className={`${baseClass}__actions-wrap`}> <div className={`${baseClass}__actions-wrap`}>
{actions && <div className={`${baseClass}__actions`}>{actions}</div>} {actions ? <div className={`${baseClass}__actions`}>{actions}</div> : null}
<div className={`${baseClass}__indicator`}> <div className={`${baseClass}__indicator`}>
<ChevronIcon direction={!isCollapsed ? 'up' : undefined} /> <ChevronIcon direction={!isCollapsed ? 'up' : undefined} />
</div> </div>