chore(comments): drop epic, sprint and review-round ids from the code
The code cited its plan instead of saying why: `E28 review J4`, `(R6 S3b)`, `S1 justified…`,
`deep-review round 5`. That plan lives in the private ops repo, so for every reader of this one the
citation was noise, and a sentence whose subject was the plan step ("round 2 showed…") hid its
lesson behind an id. Each one is gone and the "why" kept: a bare citation is deleted, a sentence
carrying a lesson is reworded around it ("a later attempt showed…").
Measured (`scripts/audit_metrics.py`, product code): 652 lines in 270 files carried an epic code by
the definition the next commit holds (507 / 241 by the old, two-digit-only one) -> 0. Across all
code, tests, scripts and configs: ~1100 epic-code lines plus ~320 sprint/round ids.
Behaviour unchanged, checked mechanically: every changed .py file has the same AST once docstrings
are blanked; css/sh/toml/yml/json files are identical once comments are stripped; the only
non-comment changes in TS/JS are test titles, one description string in a contract table, and five
ESLint messages, whose text is all the gates snapshot diff holds. Not touched: Markdown (docs and
the changelog keep their history), Alembic migrations, TV episode notation (`S2 · E5`), DESIGN.md
ids (`C1`, `B4`, `S3h`), tracker ids (`SEC-16`, `DX-17`).
One stale claim fixed on the way: test_hls_reaper's docstring said the player checkpoints "every
10 s whether or not it is playing", which plex/stream.py calls wrong; it now says what the code does.
This commit is contained in:
@@ -4,7 +4,7 @@ import { useEffect, useEffectEvent, useRef, useState, type RefObject } from "rea
|
||||
// through the shell; the onboarding wizard renders its own shell (a bare `ui/Overlay`, because it is
|
||||
// not a titled dialog with a header row) and used to have NONE of this — no trap, no initial focus,
|
||||
// no restore — so a keyboard user tabbed straight out of the first-login wizard into the app behind
|
||||
// the scrim, where the focus ring is invisible (deep-review round 5). A second hand-written copy is
|
||||
// the scrim, where the focus ring is invisible. A second hand-written copy is
|
||||
// how two shells drift apart; this is the shared one.
|
||||
|
||||
// Tabbable elements inside the dialog, in DOM order. `:not([tabindex="-1"])` drops programmatically
|
||||
@@ -19,7 +19,7 @@ export const focusablesIn = (root: HTMLElement): HTMLElement[] =>
|
||||
/** A form's first field — where a dialog opened to fill something in takes the focus: its first
|
||||
* control, unless one is marked `data-initial-focus`. The mark is for a form with a control above
|
||||
* its fields that is not one of them — the issue composer's Edit / Preview switch took the focus,
|
||||
* and typing went nowhere (E32 review). */
|
||||
* and typing went nowhere. */
|
||||
export const firstFieldIn = (root: HTMLElement): HTMLElement | undefined => {
|
||||
const all = focusablesIn(root);
|
||||
return all.find((el) => el.hasAttribute("data-initial-focus")) ?? all[0];
|
||||
@@ -58,7 +58,7 @@ export function trapTab(
|
||||
// ONE body scroll lock for every open dialog, counted. Each dialog used to save and restore
|
||||
// `overflow` on its own, so two unmounting out of order (the player's cleanup running before a Modal
|
||||
// opened above it) put back a stale "hidden". Invisible today — the app scrolls inside <main>, not
|
||||
// the document (measured, E11 S2) — but a count cannot be restored out of order, and PlayerModal's
|
||||
// the document (measured) — but a count cannot be restored out of order, and PlayerModal's
|
||||
// second copy of the lock is gone.
|
||||
let scrollLocks = 0;
|
||||
let unlockedOverflow = "";
|
||||
@@ -100,7 +100,7 @@ export function useDialogChrome(
|
||||
// the cleanup hands focus back to the trigger, and the second mount then found the focus outside
|
||||
// the dialog and moved it to the first focusable — taking it off the `autoFocus` field a beat
|
||||
// after the browser had put it there. Measured in Chrome: the command palette opened with the
|
||||
// focus on its ✕ in dev and on its search field in prod, from the same code (round 5).
|
||||
// focus on its ✕ in dev and on its search field in prod, from the same code.
|
||||
const focusedRef = useRef<HTMLElement | null>(null);
|
||||
// Whether the dialog still holds the focus. Read at cleanup rather than computed there: by the
|
||||
// time a passive cleanup runs on a real unmount the panel is already out of the document and the
|
||||
@@ -112,7 +112,7 @@ export function useDialogChrome(
|
||||
// stays reachable — so tabbing to that ✕ read as "the user left the dialog", and since removing
|
||||
// the toast fires no `focusin` to re-arm, closing the dialog afterwards stranded the focus on
|
||||
// <body> instead of handing it back to the trigger. Measured in jsdom, and a regression: before
|
||||
// this hook existed the restore was unconditional (deep-review round 6).
|
||||
// this hook existed the restore was unconditional.
|
||||
const heldRef = useRef(true);
|
||||
// Read at open, not a dependency: a caller's fresh function each render must not re-run the open.
|
||||
const pickInitial = useEffectEvent(() => initial?.() ?? null);
|
||||
@@ -144,7 +144,7 @@ export function useDialogChrome(
|
||||
// it — and while it held the focus we read that as the user walking away. Then both closing
|
||||
// together left the focus on <body>: ours skipped the restore, and the child's own
|
||||
// `restoreTo` was already detached (passive cleanups run parent-first). Measured in jsdom,
|
||||
// and it is the ordinary case — an error dialog raised over a dialog (round 6).
|
||||
// and it is the ordinary case — an error dialog raised over a dialog.
|
||||
heldRef.current =
|
||||
(owner?.contains(active) ?? false) ||
|
||||
(active instanceof Element && active.closest('[aria-modal="true"]') != null);
|
||||
@@ -171,7 +171,7 @@ export function useDialogChrome(
|
||||
// a layer closing with us is already disconnected while one that stays open is not. Without
|
||||
// this, a dialog closing on its own (an in-flight mutation's `onSuccess`) under a modal raised
|
||||
// above it pulled the focus out of that standing dialog onto our own trigger, behind its
|
||||
// scrim — where Enter still activated it (deep-review round 7).
|
||||
// scrim — where Enter still activated it.
|
||||
const owner = ownerAtOpen;
|
||||
const active = document.activeElement;
|
||||
const above = active instanceof Element ? active.closest('[aria-modal="true"]') : null;
|
||||
|
||||
Reference in New Issue
Block a user