Skip to content

Commit 34bc282

Browse files
committed
Fix grab cursor on title bar tabs and controls
- Remove cursor-grab from tab items, groups, and tab strip - Force default cursor on non-drag title bar elements via CSS - Hide aria-hidden workspace surfaces and disable pointer events
1 parent b9c7845 commit 34bc282

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎src/chrome/TitleBar.tsx‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,9 @@ function TitleTabItem({
321321
sortable.setItemRef(tab.id, el);
322322
itemRef?.(el);
323323
}}
324-
className={`group @container relative flex h-full touch-none items-center self-stretch ${
324+
className={`group @container relative flex h-full cursor-default touch-none items-center self-stretch ${
325325
deckLayout ? "min-w-0 w-full" : "w-56 min-w-28 shrink"
326-
} ${dragging ? "opacity-40" : ""} ${
327-
canDrag ? "cursor-grab active:cursor-grabbing" : ""
328-
}`}
326+
} ${dragging ? "opacity-40" : ""}`}
329327
data-tauri-drag-region="false"
330328
onPointerDown={(event) => {
331329
if (event.button !== 0) return;
@@ -361,9 +359,9 @@ function TitleTabItem({
361359
if (sortable.consumeClick()) return;
362360
onSelect(tab.id);
363361
}}
364-
className={`relative flex h-7.5 min-w-0 flex-1 items-center gap-1.5 self-center rounded-md px-2.5 text-left ${
362+
className={`relative flex h-7.5 min-w-0 flex-1 cursor-default items-center gap-1.5 self-center rounded-md px-2.5 text-left ${
365363
closable ? "pr-7" : "pr-2.5"
366-
} ${canDrag ? "cursor-grab active:cursor-grabbing" : ""} ${
364+
} ${
367365
active
368366
? "bg-content/10 text-content"
369367
: "text-content/50 hover:bg-content/5 hover:text-content"
@@ -485,8 +483,8 @@ function GroupLabel({
485483
}}
486484
onContextMenu={onContextMenu}
487485
onPointerDown={onPointerDown}
488-
className={`relative sticky left-0 z-20 flex h-7.5 max-w-36 shrink-0 items-center gap-1.5 self-center rounded-md px-2.5 pr-3 text-[11px] font-medium hover:brightness-110 ${
489-
canDrag ? "cursor-grab touch-none active:cursor-grabbing" : ""
486+
className={`relative sticky left-0 z-20 flex h-7.5 max-w-36 shrink-0 cursor-default items-center gap-1.5 self-center rounded-md px-2.5 pr-3 text-[11px] font-medium hover:brightness-110 ${
487+
canDrag ? "touch-none" : ""
490488
}`}
491489
style={{
492490
background: `color-mix(in srgb, ${color} 20%, var(--color-background-base, #1a1a1a) 80%)`,
@@ -607,7 +605,7 @@ function TabGroupBlock({
607605
return (
608606
<div
609607
ref={(el) => segmentDrag.setSegmentRef(segmentIndex, el)}
610-
className={`relative flex h-full items-center gap-0.5 ${
608+
className={`relative flex h-full cursor-default items-center gap-0.5 ${
611609
deckLayout ? "min-w-0 flex-1" : "shrink-0"
612610
} ${draggingGroup ? "opacity-40" : ""}`}
613611
data-tauri-drag-region="false"
@@ -1316,7 +1314,7 @@ function TitleBarComponent({
13161314
) : null}
13171315
<div
13181316
ref={setTabStripRef}
1319-
className="scrollbar-none flex h-full min-w-0 items-center gap-0.5 overflow-x-auto overflow-y-hidden overscroll-none px-1.5"
1317+
className="scrollbar-none flex h-full min-w-0 cursor-default items-center gap-0.5 overflow-x-auto overflow-y-hidden overscroll-none px-1.5"
13201318
>
13211319
{segments.map((segment, segmentIndex) => {
13221320
const showSegmentStart =
@@ -1388,7 +1386,7 @@ function TitleBarComponent({
13881386
<div
13891387
key={tab.id}
13901388
ref={(el) => segmentDrag.setSegmentRef(segmentIndex, el)}
1391-
className={`relative flex h-full items-center ${
1389+
className={`relative flex h-full cursor-default items-center ${
13921390
deckLayout ? "w-56 min-w-28 shrink" : "shrink-0"
13931391
} ${draggingSegment ? "opacity-40" : ""}`}
13941392
data-tauri-drag-region="false"

‎src/index.css‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ input,
184184
color: color-mix(in srgb, var(--color-content) 55%, transparent);
185185
}
186186

187+
.workspace-surface[aria-hidden="true"] {
188+
visibility: hidden;
189+
pointer-events: none;
190+
}
191+
187192
html.is-reordering,
188193
html.is-reordering * {
189194
-webkit-user-select: none !important;
@@ -257,6 +262,13 @@ html.is-resizing * {
257262
app-region: no-drag;
258263
}
259264

265+
/* Window drag regions use a grab cursor; keep title-bar controls on the arrow. */
266+
header[data-tauri-drag-region] [data-tauri-drag-region="false"],
267+
header[data-tauri-drag-region] [data-tauri-drag-region="false"] *,
268+
header[data-tauri-drag-region] button {
269+
cursor: default !important;
270+
}
271+
260272
.material-icon svg {
261273
display: block;
262274
width: 100%;

0 commit comments

Comments
 (0)