Skip to content

Keep tab focus frames outside scrolling content - #3193

Merged
max-sixty merged 2 commits into
mainfrom
codex/tab-focus-frame
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
codex/tab-focus-frame

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Scrolling Markdown code could cover a document preview's inset focus border. Page tabs used a separate overlay that could scroll into the reading. Draw one frame from the tab set, anchored to the active panel, so both cases keep a complete frame without changing layout or clipping wide page exhibits.

The focus checker also assumed a pseudo-element shared its originating element's rectangle. Read its actual browser box instead, with a planted cover test proving the old measurement misses a defect. Add pixel regressions for Markdown previews, boxed tabs, and bounded page tabs, plus scrolled gallery states in light and dark.

Validation: 12 focused browser cases after integrating main; runtime tests and browser bundle build; independent nested-tab and outer-scroll review; Chromium and Firefox journeys preserving layout and independent Preview/Source scroll positions.

Scrolled gallery preview: before and after

The code covers the middle of the upper focus border before the change; the shared frame remains continuous afterward.

Before: code covers the focus border

After: the focus frame stays continuous

This was written by Codex on behalf of max-sixty

The shared tab set now anchors its focus frame to the active panel. Positioned code cannot cover it and scrolling a bounded page tab cannot carry its frame into the reading. This preserves panel dimensions and wide page exhibits.

Read pseudo-element focus-ring geometry from the browser box model rather than its originating element. Cover this with pixel regressions, a displaced-pseudo cover test, and scrolled Markdown gallery captures.
@max-sixty
max-sixty merged commit 1bac5d5 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the codex/tab-focus-frame branch October 20, 2026 00:27
max-sixty added a commit that referenced this pull request Oct 20, 2026
…3198)

A page whose parts want different Layouts, such as a playground to try
beside the proposal and reasoning behind it, can now be a **page of
parts**. It is a `main` with no Layout holding a `header` with the
page's title and one `lf-parts`. Each `lf-part` holds one child carrying
that part's own Layout (`layout-workspace`, `layout-column`,
`layout-sidebar`). The title and the list of parts stand in a column
down the left, and the open part is laid out beside them as a page of
its own would be at that width, from the top of the window. So a
workspace part fills the window and a short part leaves nothing to
scroll. Page tabs (the first `lf-tabs` in `main`) are unchanged, and
`docs/how-it-works.html` stays on them, since its header is the one the
site's pages share.

This started from the code-comparison example. Its playground was the
page's main item but sat in a document layout, broken out of the column
above the prose.

### How it works

- **Element.** `lf-parts.js` is a dozen lines: it defines `lf-parts` as
the tab set's class (`TabSet`, exported from `lf-tabs.js`) with
`lf-part` members. The one implementation in `lf-tabs.js` gives parts:
  - a list down the side with each part's `summary`;
- a reading place per part, with the part's id as the address, as page
tabs keep theirs.

  Everything else in `lf-tabs.js` is main's.
- **Layout.** The registry gives `lf-parts` `x-views: "parts"`, which
delivery paints as `data-lf-views="parts"` before the first paint. Every
core reader keys on that mark, so no core file names the package's tag:
- `layouts.css` lays out the title, the list and the open part, and
treats a part's child as a Layout box;
- `prepaint.js` finds the Layout box and measures the title, so the list
can stick under it;
  - `content-layout.js` reads the mark too;
  - `lf-toc.js` outlines the open part;
  - `page_layout` reads the mark from the registry.
- **Phone.** The title scrolls away, and the list becomes a row that
sticks over the part as the page tabs' strip does: it joins the root's
sticky headers. So each part keeps the reader's place and links land
below the row.
- **Check.** `page check` refuses `x-views: "parts"` directly in a
`main` that carries a Layout (`parts-in-layout`). That page otherwise
renders with two Layouts fighting and passes the render check. Parts
placed anywhere else, as the corpus embeds example pages, list their
names in a row.
- **Open tab face.** A box set's or side list's open tab gains a 1px
inset contour, since its fill alone barely parted from the strip's
ground, least of all in the dark scheme. Page tabs keep their underline.

### Pages and docs

- `examples/code-comparison.html` is a page of parts: a workspace part
to compare and a column part to comment.
- The feature gallery stays on page tabs and gains a live sample of a
page of parts (`#bg-parts`).
- `page-layout.md` has "A page of parts".
- `page-authoring.md`, the registry instructions, the playground's
author instructions and the glossary say when to use parts and when page
tabs.

### Testing

- New browser tests (`test_tabs.py`, fixture `root-parts.html`) cover:
  - switching without moving the list;
  - each part's place;
  - Back and Forward;
  - first paint of a workspace part;
  - wide evidence in a part matching its twin on a page of its own;
  - the phone row. This test fails with the row static.
- `test_render_pages.py` checks the geometry of a page of parts.
- `test_playgrounds.py` checks that an artifact that changes height
leaves the stage where it stands.
- A model test covers `parts-in-layout`.
- The eval `parts-take-their-own-layouts` passed 3 of 3; each run wrote
an `lf-parts` page with a workspace to try and columns for the proposal
and reasoning. It was 0 of 3 on main for the same request.
- After merging main: the model tests (1596), the runtime tests,
`check:browser`, the parts, tab, ring and gallery navigation tests all
pass.

### Left as is

- A revision that moves an `lf-parts` into or out of `main` keeps the
list's first orientation until reload.
- The focus ring of a part is drawn on the part itself, not on the set,
as main's #3193 now does for tab sets.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
`lf-parts` runs the tab set's module, but its open part still drew its
own inset focus ring on a `::after` inside the part, the mechanism #3193
retired for tab panels. The part now takes the tab set's rules: the
holder draws the ring, anchored to the open part's border box, and the
part's own copy is deleted.

**What the user sees change.** In a page of parts the part's start edge
is the 1px rule beside the list. The old ring stood inside that rule, so
its left run sat a pixel in from the other three sides. It now runs
along the part's own edge, as a tab panel's does. Probed in Chromium and
Firefox, desktop and phone width, light and dark, at rest and scrolled;
embedded parts (no rule) and nested tab sets inside a part draw the same
as before.

**The ring reading.** In a page of parts the holder is `display:
contents`. The focus-ring reading (`ringCandidates` in
`tests/page_scripts/focus_rings.js`) asked `checkVisibility()` of it,
which is false for an element with no box, so it dropped the ring the
holder's pseudo-element paints and measured nothing at that stop. It now
judges such a pseudo by its parent's box, so the nightly Tab-stop sweep
keeps measuring the part's ring.

`test_an_open_part_wears_a_tab_panels_ring_on_its_own_edge` reads the
ring, checks its left run lies on the part's edge, and plants a cover to
show the reading still sees it. It fails without either change (base
theme: the edge pixel is the rule's colour; base reader: no ring found).

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
A boxed tab set drew its strip as a tinted band inside the card's frame,
ruled off from the panel, and marked the open tab by painting its name
as a white chip on that tint: three edges and a fill for one row of
names, and a second selected-state idiom beside the page tabs' 2px rule.
Inside a pane, the band was a box within the pane's box.

A row strip, whether a page's or a box's, now stands on its set's own
ground and marks the open tab with the page tabs' 2px rule under its
name. The edge presses fade into `--lf-tabstrip-bg`, so they fade to the
card now. The band reserved before upgrade has the same ground, so
nothing changes colour when the set upgrades. Forced colors keeps
selection visible through the rules page tabs already had, which now
cover every row strip. Side lists keep their tinted column and painted
face. The tab focus frame from #3193 is unchanged.

Cost: pages that used the tint to separate the strip from its panel
(code-comparison, pr-walkthrough) lose that contrast, and names sit 1px
higher, as they do on page tabs.

`test_an_inline_tab_keeps_its_panel_inside_one_visible_boundary` now
asserts the underline instead of the face.

Checked in Firefox and Chromium: at rest, inside a pane, keyboard focus
with hover, dark, phone with a coarse pointer, an overflowing strip,
forced colors (Chromium), and pr-walkthrough. Tests run: the edited
test, `test_a_scrolled_tab_keeps_its_focus_ring_at_the_viewport` (three
cases), `test_a_tab_strip_keeps_its_open_tab_in_its_one_row`, and `pnpm
run check:browser`.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants