Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c989a92
fix(app): restore titlebar toggle visual contract after PR #878
Astro-Han May 24, 2026
412d706
fix(app): drop selected-tab chip on right-panel sidepanel tabs
Astro-Han May 24, 2026
5844733
Revert "fix(app): drop selected-tab chip on right-panel sidepanel tabs"
Astro-Han May 24, 2026
858c394
fix(app): unify right-panel tab selection vocabulary and shrink × glyph
Astro-Han May 24, 2026
d4684fd
fix(ui): keep close × hover-only on selected sidepanel tabs
Astro-Han May 24, 2026
7883396
fix(app,ui): hover preview + uniform width for right-panel tabs
Astro-Han May 24, 2026
9fb6962
refactor(ui): grid-overlay leading cell for sidepanel close button
Astro-Han May 24, 2026
d363a29
refactor(ui,app): pill-tab geometry on 4pt grid
Astro-Han May 24, 2026
7519d45
fix(ui,app): center sidepanel tab content with anchor-positioned clos…
Astro-Han May 24, 2026
c89ce1a
fix(app,ui): address PR #880 review + CI feedback
Astro-Han May 24, 2026
bc70865
refactor(app): tighten PR #880 contract + close review nits
Astro-Han May 24, 2026
8c8e5f8
refactor(app): trim PR #880 duplication
Astro-Han May 24, 2026
7ed5e2c
fix(app): selected+hover keeps active overlay (P2) + comment drift (P3)
Astro-Han May 24, 2026
3902f44
fix(app): restructure titlebar right rail so tab strip and utility to…
Astro-Han May 24, 2026
3b16637
fix(app): keep titlebar right rail full-height so tabs slot border-l …
Astro-Han May 24, 2026
2aa0bf9
test(app): split titlebar rail tests out of session-tab-chip-contract
Astro-Han May 24, 2026
c76f8f7
fix(app): gate titlebar tabs rail on the same desktop breakpoint as S…
Astro-Han May 24, 2026
cd73d82
test(app): reword comment to avoid CodeQL js/redos false positive
Astro-Han May 24, 2026
8ec16d0
test(app): poll for layout convergence after viewport resize in rail …
Astro-Han May 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions packages/app/e2e/session/session-tab-chip-contract.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
import { expect, test, type Page } from "../fixtures"
import { openRightPanel } from "../actions"

// Contract for the right-panel tab strip after the PR #880 chip + × cleanup.
//
// 1) Selected tab background uses `--row-active-overlay` (the same selection
// overlay the sidebar session row uses), not the previous opaque
// `var(--sidebar)`. Single source of truth for "this row/tab is selected"
// across the app.
//
// 2) The × close button visual is small (~8px) — clearly subordinate to the
// leading icon. The click slot stays at 14px to preserve a comfortable
// hover target.
//
// 3) Leading icon and × overlap at the same horizontal center (within 1px).
// PR #878 fixed the swap but left a 2-3px drift because CSS literals
// (`width: 14px`, `left: 10px`) ignore that html base font-size is 13px,
// so `size-3.5` (used by leadingSpan + closeBtn) renders ~11px instead.
//
// 4) Icon swap is instant — no opacity transition. Sweeping the mouse across
// multiple tabs must not flash both icons during a fade.
//
// These assertions complement (don't replace) the snap grid in
// packages/app/e2e/snap/right-panel-tabs-hover.snap.ts.

const FILES_TAB = { name: "Files" }
const REVIEW_TAB = { name: "Review" }
const STATUS_TAB = { name: "Status" }

async function openExtraTabs(page: Page) {
await page.locator("main").first().click()
await page.keyboard.press("ControlOrMeta+\\") // fileTree.toggle
await page.keyboard.press("ControlOrMeta+Shift+R") // review.toggle
await expect.poll(() => page.getByRole("tab").count(), { timeout: 5_000 }).toBe(3)
}

async function ensureRightPanelOpen(page: Page) {
await openRightPanel(page)
}

test.describe("right-panel tab chip + × contract", () => {
test("selected tab uses --row-active-overlay (matches sidebar session row)", async ({ page, gotoSession }) => {
await gotoSession()
await ensureRightPanelOpen(page)
await openExtraTabs(page)

// Click Files so Files is selected. Then sample its computed bg.
await page.getByRole("tab", FILES_TAB).click()
await page.mouse.move(0, 0) // no hover; rest state

const tokenAndComputed = await page.evaluate(() => {
const root = document.documentElement
const tokenRaw = getComputedStyle(root).getPropertyValue("--row-active-overlay").trim()
const trig = document.querySelector('[data-slot="tabs-trigger"][data-value="files"]') as HTMLElement | null
const computed = trig ? getComputedStyle(trig).backgroundColor : ""
return { tokenRaw, computed }
})

// --row-active-overlay is defined as rgba(0,0,0,0.06) light / rgba(255,255,255,0.06) dark.
// We just assert the token resolves to a low-alpha rgba (not the previous
// opaque var(--sidebar) hex) so this test survives palette tweaks.
expect(tokenAndComputed.tokenRaw).toMatch(/rgba?\(/)
expect(tokenAndComputed.computed).toMatch(/rgba\(/) // not transparent, not solid hex
const alphaMatch = tokenAndComputed.computed.match(/rgba?\([^)]*,\s*([\d.]+)\s*\)/)
expect(alphaMatch).not.toBeNull()
const alpha = Number(alphaMatch![1])
expect(alpha).toBeGreaterThan(0)
expect(alpha).toBeLessThan(0.2) // overlay band, not opaque
})

test("× icon visual is ~8px while click slot matches leading icon size", async ({ page, gotoSession }) => {
await gotoSession()
await ensureRightPanelOpen(page)
await openExtraTabs(page)

// Hover the Files tab so the × is rendered (opacity 1).
await page.getByRole("tab", FILES_TAB).hover()

const dims = await page.evaluate(() => {
const wrap = document.querySelector('[data-slot="tabs-trigger-wrapper"][data-value="files"]')
const slot = wrap?.querySelector('[data-slot="tabs-trigger-close-button"]') as HTMLElement | null
const leadingSpan = wrap?.querySelector('[data-slot="tab-icon-default"]') as HTMLElement | null
const svg = slot?.querySelector('[data-slot="icon-svg"]') as HTMLElement | null
const box = (el: HTMLElement | null) => {
if (!el) return null
const r = el.getBoundingClientRect()
return { w: Math.round(r.width), h: Math.round(r.height) }
}
return { slot: box(slot), leading: box(leadingSpan), svg: box(svg) }
})

// Click slot must match the leading icon span. Both use `size-3.5`-aware
// sizing now (0.875rem; ~11px under the app's rem-13 base) so swapping the
// icon for the × keeps the same hit target and footprint.
expect(dims.slot?.w).toBe(dims.leading?.w)
expect(dims.slot?.h).toBe(dims.leading?.h)
// Visible × glyph: smaller than the slot — 6 to 10px so it reads as a
// subordinate affordance instead of overflowing the slot like the 16×16
// leading icon does.
expect(dims.svg?.w).toBeGreaterThanOrEqual(6)
expect(dims.svg?.w).toBeLessThanOrEqual(10)
expect(dims.svg?.h).toBeGreaterThanOrEqual(6)
expect(dims.svg?.h).toBeLessThanOrEqual(10)
})

test("× center aligns with leading icon center (within 1px)", async ({ page, gotoSession }) => {
await gotoSession()
await ensureRightPanelOpen(page)
await openExtraTabs(page)

// Measure both elements while the wrapper is hovered. The close slot is
// `position: absolute` and the leading icon span sits in normal flow, so
// their CSS contracts both reference the same wrapper origin; we just need
// a state where both are laid out (the leading span still occupies space
// even when its opacity is 0 on hover).
await page.getByRole("tab", FILES_TAB).hover()

const positions = await page.evaluate(() => {
const wrap = document.querySelector('[data-slot="tabs-trigger-wrapper"][data-value="files"]') as HTMLElement | null
const leading = wrap?.querySelector('[data-slot="tab-icon-default"]') as HTMLElement | null
const slot = wrap?.querySelector('[data-slot="tabs-trigger-close-button"]') as HTMLElement | null
const box = (el: HTMLElement | null) => {
if (!el) return null
const r = el.getBoundingClientRect()
return { x: r.x, w: r.width, center: r.x + r.width / 2 }
}
return { leading: box(leading), slot: box(slot), wrapper: box(wrap) }
})

expect(positions.leading).not.toBeNull()
expect(positions.slot).not.toBeNull()
const diff = Math.abs(positions.leading!.center - positions.slot!.center)
expect(diff).toBeLessThanOrEqual(1)
})

test("icon swap is instant (no opacity transition)", async ({ page, gotoSession }) => {
await gotoSession()
await ensureRightPanelOpen(page)
await openExtraTabs(page)
await page.mouse.move(0, 0)

const transitions = await page.evaluate(() => {
const wrap = document.querySelector(
'[data-slot="tabs-trigger-wrapper"][data-value="files"]',
) as HTMLElement | null
const icon = wrap?.querySelector('[data-slot="tab-icon-default"]') as HTMLElement | null
const closeSlot = wrap?.querySelector('[data-slot="tabs-trigger-close-button"]') as HTMLElement | null
const dur = (el: HTMLElement | null) => (el ? getComputedStyle(el).transitionDuration : null)
return { iconDur: dur(icon), closeSlotDur: dur(closeSlot) }
})

// Both must be 0s — the swap is instant on hover, not faded. Multi-property
// transitions can produce a comma-joined string like "0s, 0s"; accept any
// shape that contains only zero durations.
const allZero = (val: string | null) => val !== null && /^(0s\s*,?\s*)+$/.test(val.trim())
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
expect(allZero(transitions.iconDur)).toBe(true)
expect(allZero(transitions.closeSlotDur)).toBe(true)
})

test("Status (non-closable) shows no × on hover and keeps its icon", async ({ page, gotoSession }) => {
// Regression guard: PR #878 had a moment where Status's icon faded under
// a `:has(close-button-slot)` selector even though Status has no slot.
// The current contract is: Status icon never fades, no × ever renders.
await gotoSession()
await ensureRightPanelOpen(page)
await openExtraTabs(page)

await page.getByRole("tab", STATUS_TAB).hover()
const dims = await page.evaluate(() => {
const wrap = document.querySelector(
'[data-slot="tabs-trigger-wrapper"][data-value="status"]',
) as HTMLElement | null
const icon = wrap?.querySelector('[data-slot="tab-icon-default"]') as HTMLElement | null
const closeSlot = wrap?.querySelector('[data-slot="tabs-trigger-close-button"]')
const iconOpacity = icon ? getComputedStyle(icon).opacity : null
return { iconOpacity, hasCloseSlot: closeSlot !== null }
})

expect(dims.iconOpacity).toBe("1")
expect(dims.hasCloseSlot).toBe(false)

// Sanity: Review's wrapper still has the slot (closable peer).
const reviewHasSlot = await page.evaluate(() =>
document.querySelector(
'[data-slot="tabs-trigger-wrapper"][data-value="review"] [data-slot="tabs-trigger-close-button"]',
) !== null,
)
expect(reviewHasSlot).toBe(true)
await page.getByRole("tab", REVIEW_TAB).hover() // also closes the hover test cleanly
})
})
147 changes: 147 additions & 0 deletions packages/app/e2e/snap/right-panel-tabs-hover.snap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { expect, type Page } from "@playwright/test"
import { openRightPanel, openSidebar } from "../actions"
import { test } from "../fixtures"
import { sessionItemSelector } from "../selectors"
import { applyDarkModeForTests } from "../utils"
import { composeGrid, snapOutputPath, type Shot } from "./_compose"

// Hover-state probe for the right-panel tab strip. Captures three states of
// the closable Files tab so we can verify the close-button affordance:
//
// 1) rest — Files tab at rest, leading icon only, no close button
// 2) hover — mouse hovering Files tab; expectation: leading icon
// fades to opacity 0, close × fades in at the same 14×14
// cell, no layout shift, no double-icon visible
// 3) measurements — page-level dump of bounding boxes for the close-button
// slot vs leading icon vs label so we know exactly where
// each piece lands in screen coordinates.
//
// Why not extend right-panel-titlebar.snap.ts: that snap intentionally moves
// the mouse to (0,0) to freeze a clean static frame. Hover state needs its
// own target so the two contracts don't fight.

test.use({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2, reducedMotion: "reduce" })

async function openFilesAndReview(page: Page) {
await page.locator("main").first().click()
await page.keyboard.press("ControlOrMeta+\\")
await page.keyboard.press("ControlOrMeta+Shift+R")
await expect.poll(() => page.getByRole("tab").count(), { timeout: 5_000 }).toBe(3)
await page.getByRole("tab", { name: "Status" }).click()
}

async function dumpBoxes(page: Page, label: string) {
// Dump the bounding boxes of every interesting element in the tab strip so
// we can reason about exact positions vs the CSS-declared 14×14 + left:10
// contract in tabs.css.
const data = await page.evaluate(() => {
const tabs = Array.from(
document.querySelectorAll<HTMLElement>('[data-slot="tabs-trigger-wrapper"]'),
)
return tabs.map((wrap) => {
const trig = wrap.querySelector<HTMLElement>('[data-slot="tabs-trigger"]')
const icon = wrap.querySelector<HTMLElement>('[data-slot="tab-icon-default"]')
const iconSvg = icon?.querySelector<HTMLElement>('[data-component="icon"]')
const closeSlot = wrap.querySelector<HTMLElement>('[data-slot="tabs-trigger-close-button"]')
const closeBtn = closeSlot?.querySelector<HTMLElement>('[data-component="icon-button"]')
const closeBtnIcon = closeBtn?.querySelector<HTMLElement>('[data-component="icon"]')
const cs = (el?: HTMLElement | null) => (el ? window.getComputedStyle(el) : null)
const box = (el?: HTMLElement | null) => {
if (!el) return null
const r = el.getBoundingClientRect()
return { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) }
}
return {
value: wrap.getAttribute("data-value"),
selected: trig?.getAttribute("data-selected") === "" || trig?.hasAttribute("data-selected"),
wrapper: box(wrap),
trigger: box(trig),
leadingSpan: box(icon),
leadingIconDiv: box(iconSvg),
closeSlot: box(closeSlot),
closeBtn: box(closeBtn),
closeBtnIcon: box(closeBtnIcon),
closeSlotOpacity: cs(closeSlot)?.opacity,
leadingSpanOpacity: cs(icon)?.opacity,
triggerFontWeight: cs(trig)?.fontWeight,
}
})
})
process.stdout.write(`\n[boxes ${label}]\n${JSON.stringify(data, null, 2)}\n`)
}

async function captureStates(
page: Page,
label: "light" | "dark",
sessionID: string,
): Promise<Shot[]> {
await openSidebar(page)
await page.locator(sessionItemSelector(sessionID)).click()
await openRightPanel(page)
await openFilesAndReview(page)

// Rest state — mouse parked far away so no tab hovers.
await page.mouse.move(0, 0)
await page.waitForTimeout(200)
await dumpBoxes(page, `${label}-rest`)
const rest = {
name: `${label}-rest`,
buf: await page.screenshot({
clip: { x: 600, y: 0, width: 700, height: 80 },
animations: "disabled",
}),
}

// Hover state — hover the Files tab (closable). This should fade the
// leading icon and reveal the × close button.
await page.getByRole("tab", { name: "Files" }).hover()
await page.waitForTimeout(200)
await dumpBoxes(page, `${label}-hover-files`)
const hoverFiles = {
name: `${label}-hover-files`,
buf: await page.screenshot({
clip: { x: 600, y: 0, width: 700, height: 80 },
animations: "disabled",
}),
}

// Hover state on Review (also closable) — Review is selected by default
// after openFilesAndReview clicks Status? No, openFilesAndReview clicks
// Status; Review/Files are open but unselected. So this is hover on an
// unselected closable tab — same expected swap.
await page.getByRole("tab", { name: "Review" }).hover()
await page.waitForTimeout(200)
await dumpBoxes(page, `${label}-hover-review`)
const hoverReview = {
name: `${label}-hover-review`,
buf: await page.screenshot({
clip: { x: 600, y: 0, width: 700, height: 80 },
animations: "disabled",
}),
}

return [rest, hoverFiles, hoverReview]
}

test("right-panel-tabs-hover", async ({ page, project }) => {
test.setTimeout(180_000)

let sessionID: string | undefined
await project.open({
beforeGoto: async ({ sdk }) => {
const session = await sdk.session.create({ title: "snap right panel tabs hover" }).then((res) => res.data)
sessionID = session?.id
},
})
if (!sessionID) throw new Error("Session create did not return an id")
project.trackSession(sessionID)

const shots: Shot[] = []
shots.push(...(await captureStates(page, "light", sessionID)))
await applyDarkModeForTests(page)
shots.push(...(await captureStates(page, "dark", sessionID)))

const out = snapOutputPath("right-panel-tabs-hover")
await composeGrid(shots, out)
process.stdout.write(`\n[snap] right-panel-tabs-hover grid -> ${out}\n\n`)
})
21 changes: 14 additions & 7 deletions packages/app/src/components/titlebar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { createEffect, createMemo, Show, untrack } from "solid-js"
import { createStore } from "solid-js/store"
import { useLocation, useNavigate, useParams } from "@solidjs/router"
Expand Down Expand Up @@ -188,13 +188,20 @@
glued to the top of the titlebar.

Only populated when the right panel is open (SessionSidePanel guards its Portal). */}
{/* `pointer-events-none` on the slot mirrors `#pawwork-titlebar-left` — only
the portalled tab buttons (which carry their own `pointer-events-auto`
via the sidepanel CSS variant) should swallow clicks. Otherwise the
slot's z-10 box covers the Right utility panel toggle in
`#pawwork-titlebar-right` whenever the panel is open, making the toggle
unclickable (caught by perf-probe-baseline's session-streaming-long
run on PR #878). */}
{/* The slot is a portal landing pad, not a real Tabs root. It stamps
`data-component="tabs"` only so the existing sidepanel descendant
selectors in `packages/ui/src/components/tabs.css` still match the
portalled `Tabs.List`. Two consequences flow from that "borrowed
identity":
- Click occlusion: the slot's z-10 absolute box would swallow clicks
on the Right utility panel toggle in `#pawwork-titlebar-right`.
Fixed here with `pointer-events-none` on the slot; the portalled
tab buttons opt back in via `pointer-events-auto` on
`<Tabs.List>` (see session-side-panel.tsx).
- Visual occlusion: the base `[data-component="tabs"]` rule applies
`background-color: var(--bg-base)` to the host. The sidepanel
variant resets that to transparent in tabs.css so the slot does
not paint over the toggle button beneath it. */}
<div
id="pawwork-titlebar-tabs"
data-shell-slot="tabs-portal"
Expand Down
9 changes: 8 additions & 1 deletion packages/app/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@
border-top-width: 0;
}

/* Selected-tab chip uses the same --row-active-overlay (6% black/white) the
* sidebar session row uses for its selected state — single selection
* vocabulary across the app. Replaces the previous opaque var(--sidebar)
* chip, which read too heavy now that the tab strip lives in the titlebar.
* Paired with the fg-weak → fg-strong color shift in tabs.css; font-weight
* is not used as a selection marker (all sidepanel triggers already inherit
* 500 from text-h3 and bumping a subset of them would shift tab widths). */
[data-component="tabs"][data-variant="sidepanel"][data-scope="right-panel"]
[data-slot="tabs-trigger"][data-selected] {
background-color: var(--sidebar);
background-color: var(--row-active-overlay);
}

@media (min-width: 1280px) {
Expand Down
Loading