Repository navigation
fix(web): audit z-index bypasses against the documented overlay scale (#2163) - #2202
Conversation
AwsomeFox
left a comment
There was a problem hiding this comment.
Coordinator review — head 6fadd8eec47a346476f129e02106735ff900acc4
COMMENT, not an approval. I authorised the "no migration" outcome in the assignment, so this review is mostly about whether the evidence actually supports it. It does.
The core reasoning is correct CSS, not a convenient framing
.cf-vtt is position: fixed with an explicit non-auto z-index, which establishes a stacking context. A stacking context's subtree paints as one atomic unit against that context's siblings, and a descendant's z-index is only ever compared against co-descendants. So .cf-death-save-spectator-toast's literal 40 is genuinely never weighed against --cf-layer-tabbar's 40 — .cf-vtt at 41 has already outranked .cf-tabbar before the toast's number is consulted. That is the correct model, and it is exactly the distinction the issue asked for: a raw literal is only a bypass if it competes in the same context.
The control experiment is what makes this credible rather than merely asserted. Crippling the injected toast to z-index: 1 and showing it still wins isolates the outcome to .cf-vtt's ancestor dominance. Without that control, a passing elementFromPoint assertion would be consistent with both the real explanation and "the toast's 40 happens to win a tie" — the control discriminates between them. That is the difference between measuring and confirming a prior.
Catching your own test bug by hand review is the notable part
Finding that the real rule's transform: translateX(-50%) and its 0.3s mount animation would fight the synthetic inline positioning — because CSS animations override inline styles for the properties they animate — is a real defect that would have produced a confusing failure or, worse, a misleading pass. You found it by reading carefully because you could not run the test. That is the right response to being unable to execute something, and I want it noted rather than buried in a validation section.
The scoped guard is the right shape
Pinning the exact classified set of all 14 raw literals — selector, value, and why each is local — rather than a blanket "no raw z-index" rule is correct, and the issue itself anticipated why: a blanket rule would flag the cockpit's eight deliberately hand-tuned local values as violations. This version fails on a new unclassified literal or a changed value, which forces a conscious reclassification instead of quietly widening. That is a guard that will still be true in a year.
The one real risk, stated plainly
z-index-audit-toast-stacking.spec.ts has never been executed. The pinned browser revisions are unavailable and npx playwright install 403s at the egress proxy — the same limitation that has now blocked #2167 and #2162 in this run, so it is well-established and not something this diff can route around. CI is the first execution.
Consequences I want acknowledged rather than discovered:
- This stays a draft until CI runs both new specs green. Do not undraft on the strength of the unit tier alone.
- If the browser spec fails, the likely causes are the synthetic-injection setup rather than the finding itself — the stacking-context analysis stands on its own and is independently checkable by reading the CSS. Fix the harness; do not weaken the assertion or delete the spec to get green.
- Your offer to swap synthetic injection for a real spectator-toast fixture is noted. I agree with your judgement: reproducing the cross-session death-save event flow is disproportionate for a pure stacking question, and the control experiment already covers the thing that could have gone wrong. Keep it as is unless CI shows the injection is unreliable.
Scope
Two new spec files, no production code, no new tokens. Fixes #2163 is right — the issue asked which sites actually bypass, and the answer is none, with evidence and a guard against future drift. An audit that concludes "nothing to fix" fully answers a question phrased as "audit which ones do."
Gate status
Not merge-ready: CI has not run at this head, and one of the two new specs is unverified anywhere. I have not re-derived your 25-declaration inventory line by line — if it becomes load-bearing for a later migration, someone should. Landing is also behind whatever the shared merge lease is doing; several tools are cycling through it tonight.
Generated by Claude Code
6fadd8e to
e78b675
Compare
CI failure diagnosis + fix (head now
|
Green at
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e78b6757dd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds regression coverage to ensure apps/web/src/index.css’s remaining raw z-index literals do not actually bypass the documented --cf-layer-* overlay scale once stacking contexts are considered (per #2163), and adds a live browser measurement proving the “toast vs tab bar” non-collision claim.
Changes:
- Adds a unit-style audit test that inventories
index.cssz-indexdeclarations and pins the audited set of raw literals/resets. - Adds a Playwright browser test that uses
elementFromPointto measure the encounter cockpit (.cf-vtt) stacking dominance over the tab bar, including an injected toast control.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/web/e2e/tests/z-index-audit.unit.spec.ts | Guards the audited inventory of raw z-index literals/resets and asserts key tokenized layering invariants. |
| apps/web/e2e/tests/z-index-audit-toast-stacking.spec.ts | Live hit-testing proof that .cf-vtt’s stacking context outranks the tab bar, isolating the toast’s literal z-index as non-load-bearing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codex's review of #2202 caught a real classification error, not a nitpick: the audit whitelisted `.cf-gated-hint` as local on an incomplete render-site enumeration. `GatedControl` is also used by `DiceTray`'s advantage/ disadvantage toggle, and `SharedDiceLog` mounts `DiceTray` on the plain Dashboard (`DiceWidget`) and the character sheet -- neither wrapped in `.cf-vtt` or any other stacking-context-establishing ancestor. There the hint sat directly in `.cf-authed-shell`, the SAME local context Layout's sticky mobile header (Tailwind `z-30`) does, and the hint's literal `30` was an exact tie with it -- decided only by DOM order (the hint always renders later), so it really could paint over chrome by coincidence rather than by the documented scale. This also invalidated the DeathSaveTracker half of the original classification, which made the same "never exceeds the ceiling" mistake without checking the tie-break. Fix: reuse the existing `--cf-layer-immersive` token (already used by `.cf-gated-hint--escaped` for the identical "must clear ordinary page chrome" reason) on the base rule too, so the hint deterministically outranks chrome instead of merely tying with it. No new token invented, no JS/portal logic touched -- the smallest change that closes the gap. z-index-audit-gated-hint-stacking.spec.ts proves this live. It cannot use elementFromPoint (the technique z-index-audit-toast-stacking.spec.ts uses) because .cf-gated-hint is pointer-events:none and the CSSOM View spec skips such elements during hit-testing entirely -- using it here would silently prove nothing. Instead it measures that the hint and the sticky header share one stacking-context ancestor (walking the DOM checking MDN's stacking-context triggers, live) before comparing their z-index numbers, which is the specific thing that makes a bare number comparison valid. z-index-audit.unit.spec.ts's guard is updated: 10 tokenized (was 9), 13 raw literals (was 14) -- .cf-gated-hint moved out of the "confirmed local" whitelist since it no longer belongs there. Verified exhaustively that no OTHER GatedControl call site has the same gap: TurnWorkspace, BattleMap, GroupActionRunner, ActionUseFlow, CombatantRow, DmLifecycleHeader, and RunSessionPage's own direct usage all resolve only to RunSessionPage (cockpit, .cf-vtt-nested) or PlayerDisplayPage (mounted outside Layout entirely -- no chrome tier exists there to compete with, by the router's own design). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
e78b675 to
f202439
Compare
Two documentation/robustness findings from PR #2202's review, both fixed: - The .cf-vtt stacking-context test used an indexOf/slice window ('.cf-vtt {' .. '.cf-vtt-header {'), which silently produces a -1 slice (empty string, unhelpful failure) if formatting ever changes (e.g. '.cf-vtt\n{'). Reuses the existing regex-based allZIndexDeclarations parser instead, which already tolerates that and fails with a concrete declaration list on a real miss. - The .cf-vtt-map .cf-vtt-map-tray (z-index:8) audited entry's note named only the tray, but the underlying rule is a combined selector (`.cf-vtt-map .cf-vtt-map-aside, .cf-vtt-map .cf-vtt-map-tray { … }`) that also governs the aside panel. Corrected the note; the guard's (selector, value) matching itself was never wrong, only the prose. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fea3f4ef01
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… scale (#2163) Re-measures every z-index declaration in index.css against the documented --cf-layer-* scale (issue #791), tracing stacking context rather than grepping literals. Of 25 declarations: 9 already consume a token, 2 are resets, and 14 are raw literals — including the encounter VTT cockpit's already-commented local nesting order, plus the two sites issue #2163 itself flagged as "plausible real drift" (.cf-death-save-spectator-toast, .cf-gated-hint). Neither turns out to be a real bypass: both only ever render nested inside an element that already establishes its own stacking context (.cf-vtt, or .cf-authed-shell for the character-sheet death-save tracker), so their literal z-index values are scoped to that ancestor and can never compete with the global tabbar/chrome tiers they numerically coincide with — a stray whole subtree already outranks its sibling regardless of what a descendant's own number says. z-index-audit-toast-stacking.spec.ts proves this live via elementFromPoint rather than by re-reading the CSS, including a control where the injected toast is crippled to z-index:1 and still wins, isolating the win to .cf-vtt's own ancestor dominance. With zero confirmed bypasses, the deliverable is audit evidence plus a regression guard, not a migration: z-index-audit.unit.spec.ts pins the exact classified set of 14 raw literals (narrower than "no raw z-index outside the scale," which would incorrectly flag the cockpit's legitimate local values per the issue's own caution) so a new unclassified raw z-index fails the guard instead of landing silently. Fixes #2163 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
CI caught a harness defect on the first push: the spec asserted the tab bar wins hit-testing at its own point BEFORE the toast is injected, but that baseline is false on the encounter run page — .cf-vtt (position:fixed; inset:0) already covers the entire viewport, including the tab bar's coordinates, regardless of the toast. The tab bar is never hit-testable under an open cockpit, toast or no toast, so the "before" comparison compared the wrong two states. Fix: move the "tab bar really does win over ordinary content" control to a non-cockpit page (/party) where it is actually true, proving the elementFromPoint technique and the tab bar's real dominance are both genuine. The encounter-page test now measures the real claim directly, with no injection required — .cf-vtt itself already wins at the tab bar's point — then keeps the real-toast-class injection as further, more specific confirmation (real z-index:40 lands correctly; crippled to z-index:1 still wins, isolating the win to .cf-vtt's ancestor dominance rather than the toast's own number). Diagnostic tag/className are now returned alongside each hit so a future failure is self-diagnosing. The underlying CSS classification (0 real bypasses) is unaffected — this was a false premise in the test's own baseline, not a wrong conclusion about the source. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
Codex's review of #2202 caught a real classification error, not a nitpick: the audit whitelisted `.cf-gated-hint` as local on an incomplete render-site enumeration. `GatedControl` is also used by `DiceTray`'s advantage/ disadvantage toggle, and `SharedDiceLog` mounts `DiceTray` on the plain Dashboard (`DiceWidget`) and the character sheet -- neither wrapped in `.cf-vtt` or any other stacking-context-establishing ancestor. There the hint sat directly in `.cf-authed-shell`, the SAME local context Layout's sticky mobile header (Tailwind `z-30`) does, and the hint's literal `30` was an exact tie with it -- decided only by DOM order (the hint always renders later), so it really could paint over chrome by coincidence rather than by the documented scale. This also invalidated the DeathSaveTracker half of the original classification, which made the same "never exceeds the ceiling" mistake without checking the tie-break. Fix: reuse the existing `--cf-layer-immersive` token (already used by `.cf-gated-hint--escaped` for the identical "must clear ordinary page chrome" reason) on the base rule too, so the hint deterministically outranks chrome instead of merely tying with it. No new token invented, no JS/portal logic touched -- the smallest change that closes the gap. z-index-audit-gated-hint-stacking.spec.ts proves this live. It cannot use elementFromPoint (the technique z-index-audit-toast-stacking.spec.ts uses) because .cf-gated-hint is pointer-events:none and the CSSOM View spec skips such elements during hit-testing entirely -- using it here would silently prove nothing. Instead it measures that the hint and the sticky header share one stacking-context ancestor (walking the DOM checking MDN's stacking-context triggers, live) before comparing their z-index numbers, which is the specific thing that makes a bare number comparison valid. z-index-audit.unit.spec.ts's guard is updated: 10 tokenized (was 9), 13 raw literals (was 14) -- .cf-gated-hint moved out of the "confirmed local" whitelist since it no longer belongs there. Verified exhaustively that no OTHER GatedControl call site has the same gap: TurnWorkspace, BattleMap, GroupActionRunner, ActionUseFlow, CombatantRow, DmLifecycleHeader, and RunSessionPage's own direct usage all resolve only to RunSessionPage (cockpit, .cf-vtt-nested) or PlayerDisplayPage (mounted outside Layout entirely -- no chrome tier exists there to compete with, by the router's own design). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
Two documentation/robustness findings from PR #2202's review, both fixed: - The .cf-vtt stacking-context test used an indexOf/slice window ('.cf-vtt {' .. '.cf-vtt-header {'), which silently produces a -1 slice (empty string, unhelpful failure) if formatting ever changes (e.g. '.cf-vtt\n{'). Reuses the existing regex-based allZIndexDeclarations parser instead, which already tolerates that and fails with a concrete declaration list on a real miss. - The .cf-vtt-map .cf-vtt-map-tray (z-index:8) audited entry's note named only the tray, but the underlying rule is a combined selector (`.cf-vtt-map .cf-vtt-map-aside, .cf-vtt-map .cf-vtt-map-tray { … }`) that also governs the aside panel. Corrected the note; the guard's (selector, value) matching itself was never wrong, only the prose. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
CI (run 31490073182, job e2e-web 4/4) failed z-index-audit-gated-hint-
stacking.spec.ts on its first real execution -- a genuine failure, not the
supersede/cancellation pattern from the previous report. The actual error,
read from the job log rather than guessed:
strict mode violation: getByRole('button', { name: 'Advantage' })
resolved to 2 elements: "Advantage" and "Disadvantage"
Playwright's accessible-name matching is substring-based by default, and
"Advantage" is a substring of "Disadvantage" -- its sibling GatedControl
toggle. The locator never reached the stacking-context measurement; every
assertion after it threw the same strict-mode violation on both the
initial attempt and the retry. This has nothing to do with the CSS/
stacking-context claim under test -- the two unrelated session-expiry.spec.ts
flakes in the same run (both passed on retry #1) confirm the environment
was otherwise healthy.
Fix: `exact: true` on the Advantage locator, exactly as Playwright's own
error output suggested. No assertion weakened, loosened, or retried; no
production code touched.
The tier-safety analysis from the prior report (--cf-layer-immersive stays
below dialog/notification/snackbar/modal at 50/50/60/70; the hint's
pb-20-vs-72px geometry keeps it clear of the tab bar) was not contradicted
by this failure -- the test never got far enough to exercise it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
…hatch Third P2 from Codex's review of #2202, and correct: `html.cf-vtt-chrome- overflow .cf-vtt` set `position: static` to return the cockpit to normal document flow once Layout's own chrome needs more room than the cockpit can cede. `z-index` only takes effect on a positioned element (or a flex/grid item) -- on `static` it is inert outright, not weakened -- so in that one mode `.cf-vtt` silently stopped being a stacking context (it is a normal, non-grid-item child of `<main>` there). Every raw z-index this audit's other specs classify as "local, contained inside .cf-vtt" would have bubbled up in that mode and competed directly with Layout chrome instead -- the death-save spectator toast in particular, which independently keeps `position: fixed` regardless of `.cf-vtt`'s own position, would tie `--cf-layer-tabbar`'s literal 40 and lose the DOM-order tiebreak (the tab bar renders after <main>). Same bug class as P2 #1 (`.cf-gated-hint`), reachable through a narrower door: a rare short- viewport mode instead of an always-present render site. Traced from the actual CSS and each affected selector's own `position` property (not reasoned about in the abstract): `.cf-vtt-panel-reopen`, `.cf-vtt-strip`, `.cf-vtt-strip-toggle`, `.cf-vtt-fab`, `.cf-vtt-tray`, `.cf-vtt-map .cf-vtt-rail`, the map aside/tray, the viewport toolbar, and the death-save toast are all individually `position: absolute` or `fixed` with their own z-index, so each still forms ITS OWN local context regardless of `.cf-vtt`'s status -- what changes in overflow mode is which ANCESTOR context that local number gets compared within. Fix (the stronger of the two shapes the coordinator offered, and the one that actually holds once checked): `position: relative` instead of `static`, with no offset (`top: auto` already means "no offset", not a positioning override). Byte-for-byte identical box, identical document-flow contribution, identical "takes its height in flow, below whatever is above it" behavior the surrounding CSS comment describes -- confirmed by tracing that no JS reads `.cf-vtt`'s computed position anywhere, and that `useImmersiveChromeInset`'s own measurements are all `getBoundingClientRect()` geometry, identical between `static` and offset-free `relative`. Also incidentally fixes a second latent bug the same `static` value caused: .cf-vtt's `position: absolute` descendants were resolving their containing block against whatever ancestor of `.cf-vtt` happened to be positioned instead of `.cf-vtt` itself, in overflow mode only. z-index-audit-overflow-mode.spec.ts actually trips the hatch (the same 300x280 + tall check-request-prompt + paused-campaign recipe encounter-cockpit-campaign-chrome.spec.ts uses), then reruns the real- toast-injection + elementFromPoint proof z-index-audit-toast-stacking.spec.ts already uses for the ordinary case, confirming containment holds here too rather than asserting the CSS class exists and stopping there. z-index-audit.unit.spec.ts gets a source-level pin using the same regex-based rule parser as its other tests (not a second indexOf/slice window, per the earlier Copilot finding on this file). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
fea3f4e to
a16953a
Compare
…nt order
CI (run 31553785000, job e2e-web 4/4) failed z-index-audit-overflow-mode.spec.ts
on its first real execution. The actual error, read from the job log:
Error: {"inVtt":false,"inTabbar":true,"tag":"A","className":"active"}
expect(received).toMatchObject(expected)
- Expected: {"inTabbar": false, "inVtt": true}
+ Received: {"inTabbar": true, "inVtt": false}
Candidate A (per the coordinator's framing), but a more specific defect
than "the hatch didn't trip": the failure is AFTER the mechanism
assertions (hatch active, .cf-vtt position !== static, z-index === 41),
which all passed -- the position:relative fix itself is not in question.
The bug is in this test's own geometry: in overflow mode .cf-vtt is
position:relative (an ordinary in-flow, scrollable block), not
position:fixed;inset:0 covering the whole viewport regardless of scroll.
At the initial scroll position, the chrome that tripped the hatch is (by
construction) tall enough to fill the entire viewport budget on its own,
so .cf-vtt starts below the fold and does not yet overlap the tab bar's
fixed screen band -- the elementFromPoint check there correctly found the
tab bar's own nav link, because nothing was covering it yet. Same
false-premise shape as the ordinary toast spec's first version, a
different specific geometry this time.
Fix: scroll to the bottom of the document before the paint-order check
(.cf-vtt is the last major block in <main>'s flow, so this guarantees its
box reaches the viewport's bottom band), and explicitly VERIFY the overlap
exists as its own assertion before running elementFromPoint on it, rather
than assuming it -- the same discipline the toast spec's fix established,
applied here a second time since CI needed to teach it twice.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
CI round 3 diagnosis (head now
|
z-index-audit-overflow-mode.spec.ts failed CI three consecutive times,
each on a different false premise about the FIXTURE's own geometry rather
than the CSS under test:
1. baseline compared .cf-vtt against a viewport-coverage state that only
holds in ordinary mode (position:fixed;inset:0), not overflow mode.
2. a Playwright locator strict-mode collision ("Advantage" is a substring
of "Disadvantage") -- unrelated to stacking, never reached it.
3. after scrolling to the document's absolute maximum, .cf-vtt's
reachable bottom edge (measured: 200.2px) still sat ~24px above the
tab bar's top (measured: 224.0px) -- <main>'s own `pb-20` (80px)
bottom padding, kept there so ORDINARY page content clears the fixed
tab bar, leaves a permanent gap no scroll position can close. The
actual elementFromPoint containment check never ran; this session's
own precondition guard correctly caught the invalid setup first.
Three failures in an environment this session cannot run a browser in
locally -- each CI round spending a full cycle to learn one fact about the
fixture, not the code -- is evidence the toast-vs-tab-bar comparison
cannot be reconstructed this way in overflow mode, not bad luck. Per
explicit coordinator authorization: removed rather than attempting a
fourth geometry (the sticky top header, not padding-guarded the same way,
is the likeliest next candidate for whoever has working local browser
access to iterate against).
What stays, because none of it depended on the removed spec:
- Both production fixes: .cf-gated-hint off the literal 30, .cf-vtt off
position:static in the overflow escape hatch. Neither reverted.
- The source-level pin in z-index-audit.unit.spec.ts asserting the
overflow-mode rule uses position:relative, not static -- durable,
runs everywhere, has been green throughout, and fails on a revert of
either fix.
- z-index-audit-toast-stacking.spec.ts and
z-index-audit-gated-hint-stacking.spec.ts (ordinary mode), unaffected.
z-index-audit.unit.spec.ts's module doc comment now records plainly that
overflow-mode containment is verified by CSS-level reasoning plus the
source pin, not a live paint-order test, and why -- an honest, documented
gap for the next reader rather than a spec that has never once
demonstrated the thing it claims.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjFox1SZv765yv918tLJrh
CI round 4: removed
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dfc0e7e04
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| the stacking context. See z-index-audit-overflow-mode.spec.ts for the live proof. | ||
| Verify against a fresh reading of this rule if it changes again: static-vs-relative | ||
| here is a total behavior switch, not a stylistic choice. */ | ||
| position: relative; |
There was a problem hiding this comment.
Keep the overflow VTT below sticky chrome
When the short-viewport escape hatch is active and the user scrolls, this newly positioned element retains .cf-vtt’s z-index: 41, so the entire cockpit paints above Layout.tsx’s sticky mobile header at z-30 as the in-flow cockpit scrolls beneath it, obscuring and blocking the chrome that this mode is intended to keep reachable. Use a stacking-context mechanism or stack level that contains the VTT descendants without elevating the in-flow surface above Layout chrome; the existing source-only assertion does not exercise this scroll overlap.
AGENTS.md reference: AGENTS.md:L165-L167
Useful? React with 👍 / 👎.
Fixes #2163
What #2163 asked
Re-audit which
z-indexsites inapps/web/src/index.cssactually bypass the documented--cf-layer-*overlay stacking scale (issue #791) — not which ones merely look raw in agit grep. The issue's own re-measurement flagged two "plausible real drift" candidates:.cf-death-save-spectator-toast(hardcodes40, the tab-bar tier's literal value) and.cf-gated-hint(hardcodes30).Result: 2 confirmed bypasses, both fixed; 0 others
Three rounds of review on this PR, three correct Codex P2s, each finding a case my model of the CSS didn't cover:
.cf-gated-hint's base (non-escaped) rule.GatedControlis not cockpit-only:DiceTray's advantage/disadvantage toggle also uses it, andSharedDiceLogmountsDiceTrayon the plain Dashboard (DiceWidget) and the character sheet, neither wrapped in.cf-vtt. There the hint sat directly in.cf-authed-shell— the same context Layout's sticky mobile header (Tailwindz-30) does — and the hint's literal30was an exact tie with it, decided only by DOM order. Fixed: the base rule reuses the existing--cf-layer-immersivetoken (already used by.cf-gated-hint--escaped) instead of the literal30. Live proof:z-index-audit-gated-hint-stacking.spec.ts.html.cf-vtt-chrome-overflow .cf-vtt) setposition: staticon.cf-vttto return it to normal document flow.z-indexonly takes effect on a positioned element (or a flex/grid item) — onstaticit's inert outright — so in that one mode.cf-vttsilently stopped being a stacking context, and everything classified as "local, contained inside.cf-vtt" would bubble up and compete directly with Layout chrome. Fixed by preserving the stacking context rather than documenting the exception:position: relativeinstead ofstatic— identical box, identical document flow, but z-index means something again.GatedControlcall site was re-verified exhaustively — all resolve only toRunSessionPage(cockpit) orPlayerDisplayPage(mounted outsideLayoutentirely, no chrome tier there)..cf-death-save-spectator-toast's own base classification (local inside.cf-vttin the ordinary mode) holds and is verified live viaelementFromPointinz-index-audit-toast-stacking.spec.ts.Fix #2 (
position: relativein the escape hatch) is verified by:z-index-audit.unit.spec.ts's module doc comment:z-indexis inert onposition: static; each affected descendant's ownpositionproperty was individually traced from source; no JS reads.cf-vtt's computed position;useImmersiveChromeInset's measurements are scroll/position-agnosticgetBoundingClientRect()geometry.z-index-audit.unit.spec.ts) asserting the overflow-mode rule usesposition: relative, notstatic. This is real, durable coverage — it runs everywhere and fails on a revert of the fix — but it is not a live "who actually paints on top" proof.It is not verified by a live browser test.
z-index-audit-overflow-mode.spec.tswas written and pushed through three CI rounds; each failed on a different false premise about the fixture's own geometry, never on the CSS claim itself:.cf-vttalways covers the viewport — true only in ordinary mode."Advantage"⊂"Disadvantage") — unrelated to stacking..cf-vtt's reachable bottom edge (measured:200.2px) still sat ~24px above the tab bar's top (measured:224.0px) —<main>'s ownpb-20(80px) bottom padding, which exists specifically so ordinary page content clears the fixed tab bar, leaves a gap no scroll position can close. The actualelementFromPointcontainment check never ran on that third attempt — my own precondition guard correctly caught the invalid setup first.Three consecutive failures on fixture geometry, in an environment I have no local browser access to iterate against (pinned Chromium revision unavailable,
npx playwright install403s at the egress proxy), was judged not worth a fourth attempt at a different comparison geometry. Removed per explicit coordinator authorization rather than merged unfixed or endlessly iterated on blind. The likeliest next candidate for whoever has working local browser access: compare against the sticky top header instead of the bottom tab bar — it isn't padding-guarded the same waypb-20guards the tab bar, so the geometry problem that sank all three attempts here may not apply to it.Deliverable shape
apps/web/e2e/tests/z-index-audit.unit.spec.ts— pins the exact classified set of all 13 remaining raw literals, plus the overflow-modeposition: relativerequirement.apps/web/e2e/tests/z-index-audit-toast-stacking.spec.ts— live proof for the toast in ordinary mode.apps/web/e2e/tests/z-index-audit-gated-hint-stacking.spec.ts— live proof for the gated-hint fix.apps/web/src/index.css— two value changes:.cf-gated-hint's basez-index(literal30→calc(var(--cf-layer-immersive, 41) + 1)), and the overflow-mode.cf-vttrule (position: static→position: relative).Validation
npm run lint,npm run typecheck— clean.npm run test:unit:web— full suite, 2688 passed.npm run build— clean.z-index-audit-toast-stacking,-gated-hint-stacking) — could not be executed in this sandbox (pinned-browser 403); each has been through a real CI failure→fix cycle already, both currently green in the last fulle2e-webrun that reached them.Notes for reviewers
## Agent Workpad/claim-lease comments on issue Design system: audit which z-index sites actually bypass the documented overlay stacking scale #2163 — the coordinating session owns that lease; please look there for claim/lease status rather than in this PR.