Skip to content

Fix sidebar focus stacking, main content focus ring and pagination borders - #160

Merged
tenphi merged 1 commit into
mainfrom
claude/focus-and-pagination
Oct 15, 2026
Merged

tenphi merged 1 commit into
mainfrom
claude/focus-and-pagination

Conversation

@tenphi

@tenphi tenphi commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Three visual fixes found while browsing the docs.

Focused sidebar links were covered by the next item

The next item's fill, such as the current page's accent surface, covered the lower edge of a focused link's ring. Sidebar.InteractiveControl now gives :focus-visible controls position: relative; z-index: 1. Without offsets the link doesn't move, and the ring draws above its neighbors.

The whole article showed a focus ring during keyboard scrolling

#main-content has tabindex="-1" so the skip link and page swaps can move focus to it. Clicking any text in the article therefore focuses it. After a key press it matches :focus-visible, so scrolling with the arrow keys drew Chromium's default ring around the whole article. Cookbook's own FocusRing rule only covers controls.

MainContent now sets outline: none. The element stays the focus target. It isn't a control or in the Tab order, so the ring didn't help anyone.

Pagination links lost their resting border

Before #135, Pagination.Link used border: "$border-width solid #border". When the top-bar icon borders were removed in #135, the pagination link was reduced to a bare borderColor, which draws nothing without a width and style. #147 then made it border: "#clear", so the border only showed on hover. The top-bar icons were meant to lose their border; the pagination links were not.

The link now uses border: true, the idiom other bordered components use, so the border shows at rest again. Hover only changes colors, so geometry stays the same, and theme.styles.Pagination.Link border overrides still apply. docs/migration.md no longer says pagination reserves a transparent border. The top-bar icons still have no border.

Tests

component-ownership.spec.ts gains two tests and one extended test:

  • A keyboard-focused sidebar link is positioned with z-index: 1, and auto while unfocused.
  • After a click on the article and an ArrowDown, #main-content is focused and matches :focus-visible, but its outline-style is none.
  • The pagination hover test now also checks the resting border. In the default theme it is 1px solid in the theme's --border-color, and the custom-header override (3px dashed) still applies.

Without the style changes, all three fail: static instead of relative, auto instead of none, and a transparent border color. With them, all three pass. I also checked the reference site in Chromium.

Review and validation

I followed the local review procedure (.claude/skills/review/SKILL.md) for the diff and found no violations:

  • @own(:focus-visible) targets only the selected control.
  • Pagination keeps the same position and size on hover.
  • No component or sub-element names change, and partial theme.styles overrides merge as before.
  • The migration doc matches the new behavior.

All of these passed locally:

  • pnpm build
  • pnpm lint (zero warnings)
  • pnpm format:check
  • pnpm typecheck
  • pnpm test (409 tests)
  • pnpm check:browser (99 tests)
  • pnpm check:theming

Entropy change (renderer styles): Neutral. Each fix is a property or condition inside its owning style, with no new concept, sub-element or option. The pagination change restores the earlier declaration.

Entropy change (browser tests): Slightly Increased, justified. It adds two focused specs and three assertions to an existing one, each needed to catch its regression.

There are no exceptions or follow-ups.

🤖 Generated with Claude Code

…rders

- Sidebar: the next item's fill covered the lower edge of a focused
  link's ring. `Sidebar.InteractiveControl` now positions focus-visible
  controls with `z-index: 1`, so the ring draws above its neighbors.
- Main content: `#main-content` (tabindex -1) receives focus when its
  text is clicked, and a key press then made it match :focus-visible, so
  keyboard scrolling drew the browser's ring around the whole article.
  It is a skip-link and page-swap target, not a control; drop its
  outline.
- Pagination: #135 reduced the link's `$border-width solid #border` to a
  bare `borderColor` when the top-bar icon borders were removed, and #147
  made it `#clear`, so links lost their resting border. Restore
  `border: true`. Hover only recolors, so geometry is unchanged and
  `theme.styles.Pagination.Link` border overrides still apply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tenphi
tenphi merged commit 07c308c into main Oct 15, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
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.

1 participant