Skip to content

Commit 93d3364

Browse files
committed
fix(webapp): keep side menu secondary buttons hidden during a fast drag
The previous fix faded the account, dev connection and collapse buttons with a class based opacity transition. During a quick drag that 200ms transition lagged behind the shrinking row, so the buttons stayed briefly visible and overlapped the org and Help items (the reported dark overlay). Drive the account and dev connection opacity from the imperative --sm-label-opacity variable instead so it tracks the drag frame by frame with no lag, and hide the collapse button instantly (it cannot use the variable because it stays visible as the expand button when the menu is collapsed).
1 parent fbc3d88 commit 93d3364

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,9 +1727,10 @@ function CollapsibleElement({
17271727
}: {
17281728
isCollapsed: boolean;
17291729
/**
1730-
* Fade the element out while the menu is being drag-resized. These are the secondary right-hand
1731-
* buttons (account, dev connection); hiding them during a drag stops them from overlapping the
1732-
* primary item on the left as the row narrows.
1730+
* Keep the element non-interactive while the menu is being drag-resized. Its opacity already
1731+
* tracks the drag frame-by-frame through the imperative `--sm-label-opacity` variable (below), so
1732+
* it fades out in lockstep with the labels with no transition lag; this only stops the fading
1733+
* button from swallowing clicks.
17331734
*/
17341735
isDragging?: boolean;
17351736
children: ReactNode;
@@ -1738,11 +1739,12 @@ function CollapsibleElement({
17381739
return (
17391740
<div
17401741
className={cn(
1741-
"overflow-hidden transition-[max-width,opacity] duration-200",
1742-
isCollapsed ? "max-w-0 opacity-0" : "max-w-[100px] opacity-100",
1743-
isDragging && "pointer-events-none opacity-0",
1742+
"overflow-hidden transition-[max-width] duration-200",
1743+
isCollapsed ? "max-w-0" : "max-w-[100px]",
1744+
isDragging && "pointer-events-none",
17441745
className
17451746
)}
1747+
style={{ opacity: "var(--sm-label-opacity, 1)" }}
17461748
>
17471749
{children}
17481750
</div>
@@ -1821,12 +1823,11 @@ function CollapseMenuButton({
18211823
const [isHovering, setIsHovering] = useState(false);
18221824

18231825
return (
1824-
<div
1825-
className={cn(
1826-
"transition-opacity duration-200",
1827-
isDragging && "pointer-events-none opacity-0"
1828-
)}
1829-
>
1826+
// Hidden instantly (no opacity transition) while dragging so it never lags behind the row as it
1827+
// narrows and overlaps the Help & Feedback button. It can't fade with `--sm-label-opacity` like
1828+
// the other secondary buttons because it stays visible in the resting collapsed state (where it
1829+
// becomes the expand button).
1830+
<div className={cn(isDragging && "pointer-events-none opacity-0")}>
18301831
<TooltipProvider disableHoverableContent>
18311832
<Tooltip delayDuration={isCollapsed ? 0 : 500}>
18321833
<TooltipTrigger asChild>

0 commit comments

Comments
 (0)