Skip to content

Commit db330d8

Browse files
committed
fix(web): keep the unpin icon in place when hovering a pinned thread
The pin marker sits directly left of the sidebar row's status slot, which used to swap which state is in flow on hover: the time label left the flow and the Settle actions entered it. Every width change dragged the pin sideways. The slim row had the same problem in its Woke state. The card slot now stacks the status label and the hover actions in one grid cell, so it is always as wide as its wider state and only opacity swaps on hover. The slim row keeps its Woke action in flow at rest for the same reason. The unpin button also swaps to the pin-off glyph on hover and focus so the icon reads as the action it performs. Made by Claude Fable 5.1 in Claude Code.
1 parent 112a708 commit db330d8

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,11 +1541,20 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
15411541
type="button"
15421542
aria-label="Unpin thread"
15431543
onClick={handleUnpinClick}
1544-
className="inline-flex cursor-pointer items-center rounded-sm text-muted-foreground/65 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
1544+
className="group/unpin inline-flex cursor-pointer items-center rounded-sm text-muted-foreground/65 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
15451545
/>
15461546
}
15471547
>
1548-
<PinIcon aria-hidden className="size-3 shrink-0" />
1548+
{/* Pin marks the pinned state at rest; hover and focus swap in pin-off so the
1549+
icon reads as the action the button performs. */}
1550+
<PinIcon
1551+
aria-hidden
1552+
className="size-3 shrink-0 group-hover/unpin:hidden group-focus-visible/unpin:hidden"
1553+
/>
1554+
<PinOffIcon
1555+
aria-hidden
1556+
className="hidden size-3 shrink-0 group-hover/unpin:block group-focus-visible/unpin:block"
1557+
/>
15491558
</TooltipTrigger>
15501559
<TooltipPopup>Unpin thread</TooltipPopup>
15511560
</Tooltip>
@@ -1662,7 +1671,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
16621671
onClick={handleUnsnoozeClick}
16631672
className={cn(
16641673
"pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-hover/sidebar-row:pointer-events-auto group-hover/sidebar-row:opacity-100",
1665-
isWoke && "group-hover/sidebar-row:static",
1674+
isWoke && "static",
16661675
)}
16671676
>
16681677
<AlarmClockOffIcon className="mb-px size-3" />
@@ -1678,7 +1687,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
16781687
onClick={handleUnsettleClick}
16791688
className={cn(
16801689
"pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-hover/sidebar-row:pointer-events-auto group-hover/sidebar-row:opacity-100",
1681-
isWoke && "group-hover/sidebar-row:static",
1690+
isWoke && "static",
16821691
)}
16831692
/>
16841693
}
@@ -1694,7 +1703,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
16941703
onClick={handleSettleClick}
16951704
className={cn(
16961705
"pointer-events-none absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-hover/sidebar-row:pointer-events-auto group-hover/sidebar-row:opacity-100",
1697-
isWoke && "group-hover/sidebar-row:static",
1706+
isWoke && "static",
16981707
)}
16991708
>
17001709
<CheckIcon className="size-3" />
@@ -1759,24 +1768,23 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
17591768
<span className="flex-1" />
17601769
)}
17611770
{pinIndicator}
1762-
{/* The visible state owns this slot's width: status at rest,
1763-
actions on hover/keyboard focus or while the popover is open. Keeping
1764-
the hidden state out of flow lets the project label reclaim
1765-
space without either state overlapping it. */}
1771+
{/* Status and hover actions share one grid cell, so it is always as wide as
1772+
its wider state and only opacity swaps on hover. That keeps the pin marker
1773+
to its left from shifting; short labels reserve a little extra space. */}
17661774
{sortable?.isDragging ? (
17671775
dragDestination
17681776
) : (
1769-
<span className="group/sidebar-status-slot relative ml-auto flex h-5 min-w-8 shrink-0 items-stretch justify-end text-xs">
1777+
<span className="group/sidebar-status-slot ml-auto grid h-5 min-w-8 shrink-0 grid-flow-col items-stretch justify-end text-xs">
17701778
{/* Read-only status labels yield to the hover actions. Woke is
1771-
itself an action, so it stays pointer-enabled and visible
1772-
while the other controls appear beside it. */}
1779+
itself an action, so it keeps its own column and stays
1780+
pointer-enabled while the other controls appear beside it. */}
17731781
<span
17741782
className={cn(
17751783
isWokeStatus
17761784
? "pointer-events-auto"
1777-
: "pointer-events-none group-has-[:focus-visible]/sidebar-status-slot:absolute group-has-[:focus-visible]/sidebar-status-slot:right-0 group-has-[:focus-visible]/sidebar-status-slot:opacity-0 group-hover/sidebar-row:absolute group-hover/sidebar-row:right-0 group-hover/sidebar-row:opacity-0",
1785+
: "pointer-events-none [grid-area:1/1] group-has-[:focus-visible]/sidebar-status-slot:opacity-0 group-hover/sidebar-row:opacity-0",
17781786
"flex items-center self-center justify-self-end tabular-nums text-secondary-label transition-opacity",
1779-
snoozeMenuOpen && "pointer-events-none absolute right-0 opacity-0",
1787+
snoozeMenuOpen && "pointer-events-none opacity-0",
17801788
)}
17811789
>
17821790
{topStatus ? (
@@ -1843,8 +1851,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
18431851
// would keep the controls pinned over the status label
18441852
// once the pointer moves away (e.g. after a failed
18451853
// settle) instead of cross-fading back.
1846-
"pointer-events-none absolute inset-y-0 right-0 flex items-stretch opacity-0 transition-opacity has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:static has-[:focus-visible]:opacity-100 group-hover/sidebar-row:pointer-events-auto group-hover/sidebar-row:static group-hover/sidebar-row:opacity-100",
1847-
snoozeMenuOpen && "pointer-events-auto static opacity-100",
1854+
"pointer-events-none flex items-stretch justify-self-end opacity-0 transition-opacity has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100 group-hover/sidebar-row:pointer-events-auto group-hover/sidebar-row:opacity-100",
1855+
!isWokeStatus && "[grid-area:1/1]",
1856+
snoozeMenuOpen && "pointer-events-auto opacity-100",
18481857
)}
18491858
>
18501859
{hasUnsentDraft ? (

0 commit comments

Comments
 (0)