Compare commits

...
Author SHA1 Message Date
paseo-bot[bot]andClaude Opus 5.5 6c94ab046f refactor(app): give the sidebar row "actions always visible" rule one home
The rule was written out in the workspace, status and project rows and
passed to resolveTrailingActionVisibility as isTouchPlatform, which no
longer meant a touch platform. useRowActionsAlwaysVisible() now owns it
(compact layout or no fine pointer; the native pointer source already
reports no fine pointer), and the parameter is named for what it means.
Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 00:15:48 +00:00
aa1e4c8ad6 fix(app): keep hover-revealed row menus for mouse-driven touch-screen laptops
Show the always-visible row menu only when the primary pointer cannot
hover, the same check the sidebar resize grip uses. A touch-screen laptop
driven by a mouse keeps its row stats, hover archive button, and
hover-revealed menu.

Co-authored-by: Matt Abar <mattaabar@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 23:03:02 +00:00
Matt AbarandClaude Opus 5.5 9fe97efb34 test(app): pin the web touch grip offset in the layout test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:09:56 -07:00
Matt AbarandClaude Opus 5.5 cfd32891f5 fix(app): make the web touch resize grip easy to see
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:08:30 -07:00
Matt AbarandClaude Opus 5.5 7792a1d697 fix(app): keep the web touch grip inside the sidebar, level with the top rows
The previous commit moved the web touch grip just outside the sidebar so it
would not cover a row's menu button. But the sidebar clips its overflow, and
in a browser that clips hit-testing too, so a finger could no longer reach the
grip and the sidebar could not be resized by touch.

On the web the touch grip now stays inside the sidebar and sits level with the
top navigation rows (New workspace, History, Search), which have nothing at
their right edge, and it shows faintly at rest so it can be found. Native
keeps the centred grip, and the explorer sidebar is unchanged.

A browser test drags the grip with a finger and checks that nothing covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:53:53 -07:00
Matt AbarandClaude Opus 5.5 eacbbfca80 fix(app): keep the web touch resize grip off the sidebar row menus
The touch resize grip sits inside the sidebar because native hit-testing
clips to the sidebar. On a touch screen in the browser it then covered the
right edge of the rows, where the row menu button now always shows, so a
tap on the menu started a resize instead. Browsers do not clip hit-testing,
so on the web the touch grip sits just outside the sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:37:45 -07:00
Matt AbarandClaude Opus 5.5 976e47ae3f fix(app): show sidebar row menus on touch screens
An iPad in the browser runs the desktop layout with the sidebar pinned.
Its workspace and project rows showed their kebab only on hover, which a
touch screen can't do, and iOS Safari fires no contextmenu for a long
press, so the row menu (rename, pin, archive, copy path) was unreachable.

Rows now treat any touch screen (any-pointer: coarse, from the existing
pointer-capabilities hook) like the native and compact layouts for the
kebab, so it stays visible and opens with a tap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:37:45 -07:00
7 changed files with 180 additions and 19 deletions
@@ -718,3 +718,108 @@ test.describe("Half-screen desktop layout", () => {
}
});
});
// An iPad in the browser runs the desktop layout with the sidebar pinned, but it can't hover,
// and iOS Safari fires no contextmenu event for a long press. The kebab is the only way in.
test.describe("Workspace row menu on a wide touch screen", () => {
test.use({ viewport: { width: 1194, height: 834 }, isMobile: true, hasTouch: true });
test("shows the row's menu button without hovering and opens it with a tap", async ({
page,
}, info) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-touch-menu-" });
const workspaceKey = `${getServerId()}:${workspace.workspaceId}`;
try {
await gotoAppShell(page);
await waitForSidebarWorkspace(page, workspace.workspaceId);
const kebab = page.getByTestId(`sidebar-workspace-kebab-${workspaceKey}`);
await expect(kebab).toBeVisible({ timeout: 30_000 });
await expect(kebab).toHaveCSS("opacity", "1");
await page.screenshot({ path: info.outputPath("touch-sidebar-row-menu.png") });
await kebab.tap();
await expect(
page.getByTestId(`sidebar-workspace-menu-copy-path-${workspaceKey}`),
).toBeVisible({ timeout: 30_000 });
} finally {
await workspace.cleanup();
}
});
test("resizes the sidebar with a finger drag on its grip", async ({ page, context }, info) => {
await gotoAppShell(page);
const grip = page.getByTestId("left-sidebar-resize-handle");
await expect(grip).toBeVisible({ timeout: 30_000 });
const before = await grip.boundingBox();
if (!before) throw new Error("The sidebar resize grip has no box");
const x = before.x + before.width / 2;
const y = before.y + before.height / 2;
// Nothing else may sit on top of the grip, or a finger can't reach it.
const hit = await page.evaluate(
({ px, py }) =>
document.elementFromPoint(px, py)?.closest("[data-testid]")?.getAttribute("data-testid"),
{ px: x, py: y },
);
expect(hit).toBe("left-sidebar-resize-handle");
const cdp = await context.newCDPSession(page);
await cdp.send("Input.dispatchTouchEvent", {
type: "touchStart",
touchPoints: [{ x, y, id: 1 }],
});
for (let step = 1; step <= 10; step += 1) {
await cdp.send("Input.dispatchTouchEvent", {
type: "touchMove",
touchPoints: [{ x: x + step * 8, y, id: 1 }],
});
}
await cdp.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
await expect
.poll(async () => (await grip.boundingBox())?.x ?? before.x, { timeout: 10_000 })
.toBeGreaterThan(before.x + 40);
await page.screenshot({ path: info.outputPath("touch-sidebar-resized.png") });
});
});
// A touch-screen laptop driven by a mouse reports a coarse pointer among its pointers, but its
// primary pointer hovers, so rows keep revealing their menu on hover.
test.describe("Workspace row menu on a touch-screen laptop with a mouse", () => {
test.use({ viewport: { width: 1440, height: 900 } });
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
const browserMatchMedia = window.matchMedia.bind(window);
window.matchMedia = (query: string) => {
const result = browserMatchMedia(query);
if (query !== "(any-pointer: coarse)") return result;
return new Proxy(result, {
get: (target, key) => {
if (key === "matches") return true;
const value: unknown = Reflect.get(target, key, target);
return typeof value === "function" ? value.bind(target) : value;
},
});
};
});
});
test("keeps the row's menu button behind hover", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-hybrid-menu-" });
const workspaceKey = `${getServerId()}:${workspace.workspaceId}`;
try {
await gotoAppShell(page);
const row = await waitForSidebarWorkspace(page, workspace.workspaceId);
expect(await page.evaluate(() => window.matchMedia("(any-pointer: coarse)").matches)).toBe(
true,
);
const kebab = page.getByTestId(`sidebar-workspace-kebab-${workspaceKey}`);
await expect(kebab).toHaveCount(0);
await row.hover();
await expect(kebab).toBeVisible({ timeout: 10_000 });
} finally {
await workspace.cleanup();
}
});
});
@@ -12,6 +12,20 @@ describe("resolveSidebarResizeHandleGeometry", () => {
expect(geometry.height ?? 0).toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
});
it("keeps a web touch grip inside the sidebar, level with the top navigation rows", () => {
const geometry = resolveSidebarResizeHandleGeometry(false, true);
// The sidebar clips its overflow, so a grip outside it can't be touched.
expect(geometry.edgeOffset).toBeGreaterThanOrEqual(0);
expect(geometry.width).toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
// Not centred, where it would cover a row's menu button.
expect(geometry.top).toBe(48);
});
it("centres the native touch grip", () => {
expect(resolveSidebarResizeHandleGeometry(false).top).toBeNull();
});
it("straddles the border for a fine pointer", () => {
const geometry = resolveSidebarResizeHandleGeometry(true);
@@ -10,6 +10,13 @@
* children whose ancestors contain the point. A strip hanging outside the
* sidebar is dead on touch, and what remains is far too small for a finger.
* So the touch variant sits fully inside the sidebar and is sized for a thumb.
*
* A touch screen on the web (an iPad in the browser) shows every row's menu button
* at the sidebar's right edge, and a grip centred on that edge covers the menu of
* whichever row is at mid-height. The grip can't move outside the sidebar either:
* the sidebar clips its overflow, which in a browser also clips hit-testing. So on
* the web the touch grip stays inside and sits level with the top navigation rows
* (New workspace, History, Search...), which have nothing at their right edge.
*/
export const POINTER_HANDLE_WIDTH = 10;
@@ -37,21 +44,29 @@ export interface SidebarResizeHandleGeometry {
width: number;
/** `null` stretches the hit area to the sidebar's full height. */
height: number | null;
/** Distance from the sidebar's top to the hit area; `null` centres it vertically. */
top: number | null;
}
/** The web touch grip's distance from the sidebar top: beside the top navigation rows. */
export const WEB_TOUCH_HANDLE_TOP = 48;
export function resolveSidebarResizeHandleGeometry(
finePointer: boolean,
web = false,
): SidebarResizeHandleGeometry {
if (finePointer) {
return {
edgeOffset: -POINTER_HANDLE_WIDTH / 2,
width: POINTER_HANDLE_WIDTH,
height: null,
top: null,
};
}
return {
edgeOffset: 0,
width: TOUCH_HANDLE_WIDTH,
height: TOUCH_HANDLE_HEIGHT,
top: web ? WEB_TOUCH_HANDLE_TOP : null,
};
}
@@ -85,14 +85,24 @@ function PointerResizeHandle({ edge, gesture, testID }: SidebarResizeHandleProps
);
}
// On the web the grip shows at rest, so a touch user can find it.
function restingGripStyle(pressed: boolean) {
if (pressed) return styles.visibleGrip;
if (isWeb) return styles.restingGrip;
return styles.hiddenGrip;
}
function TouchResizeHandle({ edge, gesture, pressed, testID }: SidebarResizeHandleProps) {
const geometry = resolveSidebarResizeHandleGeometry(false);
const geometry = resolveSidebarResizeHandleGeometry(false, isWeb && edge === "right");
// `box-none` keeps the full-height column out of hit-testing so only the
// grab target steals taps from the rows behind it.
const layerStyle = [
styles.touchLayer,
{ width: geometry.width },
edgeOffsetStyle(edge, geometry.edgeOffset),
geometry.top === null
? null
: { justifyContent: "flex-start" as const, paddingTop: geometry.top },
];
const targetStyle = [
styles.touchTarget,
@@ -101,7 +111,7 @@ function TouchResizeHandle({ edge, gesture, pressed, testID }: SidebarResizeHand
const gripStyle = [
styles.grip,
edge === "left" ? styles.leftEdgeGrip : styles.rightEdgeGrip,
pressed ? styles.visibleGrip : styles.hiddenGrip,
restingGripStyle(pressed),
];
return (
@@ -159,7 +169,10 @@ const styles = StyleSheet.create((theme) => ({
opacity: 0,
},
visibleGrip: {
opacity: 0.3,
opacity: 0.55,
},
restingGrip: {
opacity: 0.35,
},
leftEdgeGrip: {
alignSelf: "flex-start",
@@ -106,6 +106,7 @@ import {
SidebarWorkspaceRowContent,
SidebarWorkspaceShortcutBadge,
resolveTrailingActionVisibility,
useRowActionsAlwaysVisible,
SidebarWorkspaceTrailingActionBase,
SidebarWorkspaceTrailingActionOverlay,
SidebarWorkspaceTrailingActionSlot,
@@ -409,7 +410,6 @@ function ProjectRowTrailingActions({
settingsTarget,
projectPath,
isHovered,
isMobileBreakpoint,
isProjectActive,
onBeginWorkspaceSetup,
onRemoveProject,
@@ -421,13 +421,12 @@ function ProjectRowTrailingActions({
settingsTarget: { serverId: string; projectId: string } | null;
projectPath: string;
isHovered: boolean;
isMobileBreakpoint: boolean;
isProjectActive: boolean;
onBeginWorkspaceSetup: () => void;
onRemoveProject?: () => void;
removeProjectStatus: "idle" | "pending" | "success";
}) {
const actionsVisible = isHovered || platformIsNative || isMobileBreakpoint;
const actionsVisible = useRowActionsAlwaysVisible() || isHovered;
return (
<View style={styles.projectTrailingActions}>
{worktreeTarget ? (
@@ -604,7 +603,7 @@ function WorkspaceRowRightGroup({
workspace,
backdrop,
isHovered,
isTouchPlatform,
actionsAlwaysVisible,
isCreating,
showShortcutBadge,
shortcutNumber,
@@ -624,7 +623,7 @@ function WorkspaceRowRightGroup({
workspace: SidebarWorkspaceEntry;
backdrop: SidebarSurfaceBackdrop;
isHovered: boolean;
isTouchPlatform: boolean;
actionsAlwaysVisible: boolean;
isCreating: boolean;
showShortcutBadge: boolean;
shortcutNumber: number | null;
@@ -657,7 +656,7 @@ function WorkspaceRowRightGroup({
trailing,
hasArchiveAction: Boolean(onArchive),
isHovered,
isTouchPlatform,
actionsAlwaysVisible,
showShortcut,
});
const kebab = useOpenKebabMenuVisibility(showKebabInSlot);
@@ -881,7 +880,6 @@ function ProjectHeaderRow({
const [isHovered, setIsHovered] = useState(false);
const [isHighlighted, setIsHighlighted] = useState(false);
const [contextMenuOpen, setContextMenuOpen] = useState(false);
const isMobileBreakpoint = useIsCompactFormFactor();
const localDaemonServerId = useLocalDaemonServerId();
const projectPath = resolveSidebarProjectLocalPath(project, localDaemonServerId);
const settingsTarget = project.hosts[0] ?? null;
@@ -964,7 +962,6 @@ function ProjectHeaderRow({
settingsTarget={settingsTarget}
projectPath={projectPath}
isHovered={isHovered}
isMobileBreakpoint={isMobileBreakpoint}
isProjectActive={isProjectActive}
onBeginWorkspaceSetup={handleBeginWorkspaceSetup}
onRemoveProject={onRemoveProject}
@@ -1079,6 +1076,7 @@ function WorkspaceRowInner({
const isCompact = useIsCompactFormFactor();
const [isHighlighted, setIsHighlighted] = useState(false);
const isTouchPlatform = platformIsNative || isCompact;
const actionsAlwaysVisible = useRowActionsAlwaysVisible();
const interaction = useLongPressDragInteraction({
drag,
menuController,
@@ -1173,7 +1171,7 @@ function WorkspaceRowInner({
workspace={workspace}
backdrop={backdrop}
isHovered={isHovered}
isTouchPlatform={isTouchPlatform}
actionsAlwaysVisible={actionsAlwaysVisible}
isCreating={isCreating}
showShortcutBadge={showShortcutBadge}
shortcutNumber={shortcutNumber}
@@ -46,6 +46,7 @@ import {
SidebarWorkspaceRowFrame,
SidebarWorkspaceRowContent,
resolveTrailingActionVisibility,
useRowActionsAlwaysVisible,
type SidebarWorkspaceTrailingPresentation,
SidebarWorkspaceTrailingActionBase,
SidebarWorkspaceTrailingActionOverlay,
@@ -828,6 +829,7 @@ function StatusWorkspaceRowInnerContent({
}) {
const isCompact = useIsCompactFormFactor();
const isTouchPlatform = platformIsNative || isCompact;
const actionsAlwaysVisible = useRowActionsAlwaysVisible();
const [isHighlighted, setIsHighlighted] = useState(false);
const trailing = useSidebarWorkspaceTrailing();
const {
@@ -874,7 +876,7 @@ function StatusWorkspaceRowInnerContent({
trailing,
hasArchiveAction: Boolean(onArchive),
isHovered,
isTouchPlatform,
actionsAlwaysVisible,
showShortcut,
});
const workspaceRowStyle = getStatusWorkspaceRowStyle({
@@ -16,6 +16,8 @@ import {
type SidebarWorkspaceTrailing,
} from "@/components/sidebar/workspace-trailing";
import { useAppSettings } from "@/hooks/use-settings";
import { usePointerCapabilities } from "@/hooks/pointer-capabilities";
import { useIsCompactFormFactor } from "@/constants/layout";
import { densityIconBox } from "@/styles/density";
import type { Theme } from "@/styles/theme";
import type { SidebarStateBucket } from "@/utils/sidebar-agent-state";
@@ -365,6 +367,17 @@ export function SidebarWorkspaceShortcutBadge({ number }: { number: number }) {
export type SidebarWorkspaceTrailingPresentation = "visible" | "hidden" | "absent";
/**
* Whether a sidebar row keeps its actions shown instead of revealing them on hover. True on the
* compact layout and wherever the primary pointer can't hover: native apps, and a touch screen in
* a wide browser (an iPad in Safari), where the menu button is the only way to the row menu.
*/
export function useRowActionsAlwaysVisible(): boolean {
const isCompact = useIsCompactFormFactor();
const { finePointer } = usePointerCapabilities();
return isCompact || !finePointer;
}
/**
* What the trailing slot shows for a row. Derived in one place because three row renderers
* share it: the two project-mode rows and the status-mode row. The rule used to be copied
@@ -380,14 +393,14 @@ export function resolveTrailingActionVisibility({
trailing,
hasArchiveAction,
isHovered,
isTouchPlatform,
actionsAlwaysVisible,
showShortcut,
}: {
workspace: SidebarWorkspaceEntry;
trailing: SidebarWorkspaceTrailing;
hasArchiveAction: boolean;
isHovered: boolean;
isTouchPlatform: boolean;
actionsAlwaysVisible: boolean;
showShortcut: boolean;
}): {
trailingPresentation: SidebarWorkspaceTrailingPresentation;
@@ -398,10 +411,11 @@ export function resolveTrailingActionVisibility({
reserveSlotWidth: boolean;
} {
const hasTrailing = hasSidebarWorkspaceTrailing({ workspace, trailing });
const showKebab = Boolean(hasArchiveAction && (isHovered || isTouchPlatform)) && !showShortcut;
const showKebab =
Boolean(hasArchiveAction && (isHovered || actionsAlwaysVisible)) && !showShortcut;
// Touch permanently replaces the stats with the menu. Only temporary shortcut hints
// conceal content while retaining its width, so desktop rows do not shift.
const hasContent = hasTrailing && !(hasArchiveAction && isTouchPlatform);
const hasContent = hasTrailing && !(hasArchiveAction && actionsAlwaysVisible);
let trailingPresentation: SidebarWorkspaceTrailingPresentation = "absent";
if (hasContent) trailingPresentation = showShortcut ? "hidden" : "visible";
return {
@@ -409,7 +423,7 @@ export function resolveTrailingActionVisibility({
showKebab,
// One-click archive is a pointer affordance: on touch it would sit a few pixels from the
// kebab and turn a miss into an archive.
showArchiveButton: showKebab && isHovered && !isTouchPlatform,
showArchiveButton: showKebab && isHovered && !actionsAlwaysVisible,
// The scrim paints the row's own hover background, so it can only be drawn on a hovered
// row — over an unhovered one the gradient fades to the wrong color. That is also why
// touch, which shows the kebab without ever hovering, never gets one.
@@ -419,7 +433,7 @@ export function resolveTrailingActionVisibility({
// does; the kebab only does on touch, where there is no hover for it to appear on and so
// no scrim to let it overlay the title. Everywhere else the width goes back to the title
// and the kebab fades in over its tail.
reserveSlotWidth: hasContent || (hasArchiveAction && isTouchPlatform),
reserveSlotWidth: hasContent || (hasArchiveAction && actionsAlwaysVisible),
};
}