Skip to content

fix(docs-theme): show one focus ring on the API property filter - #416

Merged
nickvigilante merged 3 commits into
mainfrom
vigilante/api-filter-focus
Nov 30, 2026
Merged

nickvigilante merged 3 commits into
mainfrom
vigilante/api-filter-focus

Conversation

@nickvigilante

Copy link
Copy Markdown
Collaborator

Merge order

Independent.

Summary

Clicking or tabbing into "Filter Properties" in an API operation's request or response schema panel showed two focus indicators, one on the box and one on the inner text field. It now shows one, on the box.

Fix

The field is fumadocs-openapi 12.6.1's own schema UI: a label (focus-within:ring-1 focus-within:ring-fd-ring, a 1px box-shadow) containing an input with the Tailwind utility outline-none. brand.css is imported unlayered, and unlayered CSS beats @layer utilities whatever the specificity, so the global :where(a, button, input, summary, [tabindex]):focus-visible { outline: 2px solid var(--color-fd-ring) } overrode outline-none and outlined the input inside the label's ring.

I chose the label as the single indicator, scoped to .coder-api-page: label:has(> input:focus-visible) gets the same 2px ring-colour outline as the rest of the site, with box-shadow: none to drop the library's ring, and label > input:focus-visible gets outline: none. The field is a text input, so :focus-visible matches on mouse click as well as keyboard, as it did before. Accessibility: exactly one visible indicator; the ring colour is the site's existing focus token, which is already covered by the contrast check (contrast:check passes: standard 81/81 AA, More 81/81 AAA); More contrast uses the same token's More value; a real outline (unlike the box-shadow ring, which forced-colors mode removes) stays visible in forced-colors mode, so this also fixes that mode having no indicator; outline takes no space, so there is no layout shift and no border or padding change (offset 1px to keep it small).

QA

Operation pages only show this after the engine is republished with the new API reference, so use the preview. Firefox steps are not verified; I had no browser here and the visual result is inferred from the CSS and library source.

  1. Open the preview of the Create user workspace by organization page (see the table). Scroll to the Request body panel, which has a "Filter Properties" box with a funnel icon.
  2. Click into the box. Expected: one blue ring around the whole box, none around the text inside it, and nothing moves.
  3. Press Tab to leave and Shift+Tab to return. Expected: the same single ring each time.
  4. Repeat in the response schema panel further down, in light and dark theme, and with the More contrast option in the theme control (or the OS setting in Chrome or Firefox). Expected: still one ring, and it is clearly visible.
  5. In Windows high contrast or forced colours mode, if available, focus the box. Expected: one outline shows.

Pages to compare

The preview alias always serves the latest deploy and needs a Vercel login.

What to check Production Preview
Filter Properties focus on a request body https://coder.com/docs/reference/api/workspaces/create-user-workspace-by-organization/ Preview URL in the docs preview comment on this PR (branch alias of vigilante/api-filter-focus)

Testing

brand.test.mjs gained a test that pins the label's 2px ring outline with box-shadow: none and the input's outline: none. It failed on the old CSS (no such rules) and passes now. All 37 docs-theme tests pass, as do pnpm lint in docs-theme (oxlint, oxfmt, Stylelint) and contrast:check. Not run: next build (aborts under the memory cap), the axe pass, and any browser check.

Upstream

Maybe. The library's input relies on outline-none and a 1px ring that forced-colors mode removes, which is a generic accessibility gap, but the double ring comes from our unlayered global rule. Nothing filed.

No Linear issue.


🤖 Built with AI assistance.

The Fumadocs OpenAPI schema panel's "Filter Properties" field draws a 1px ring on its label and relies on a Tailwind outline-none on the input. brand.css is unlayered, so the global input focus outline beat that utility and the focused field got a second, 2px outline inside the ring.
The label now carries the one indicator, a 2px outline matching the site's focus style that forced-colors keeps, and the library's box-shadow ring and the input's own outline are dropped.

Assisted-by: AI
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
coder-docs Skipped Skipped Nov 30, 2026 4:17pm UTC

Request Review

…focus

# Conflicts:
#	packages/docs-theme/scripts/brand.test.mjs
@github-actions

Copy link
Copy Markdown

Docs preview deployment

Rendered with docs-engine d6cd080 from coder/coder at 6bd3e2d1b01e3db5e835ed30bc7fecd643ee589b: https://coder-docs-3oqw5u80y.coderite.app

The preview is behind Vercel authentication; sign in with your Coder Vercel account.

@nickvigilante
nickvigilante marked this pull request as ready for review November 30, 2026 18:04
@nickvigilante
nickvigilante requested a review from a team as a code owner November 30, 2026 18:04

@Jesswinters Jesswinters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focus ring ftw! 🟢

@nickvigilante
nickvigilante merged commit 86d0788 into main Nov 30, 2026
37 checks passed
@nickvigilante
nickvigilante deleted the vigilante/api-filter-focus branch November 30, 2026 18:07

@ianjevans ianjevans left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This branch was successfully deployed

1 active and 1 inactive (outdated) deployments
docs-preview — 027a3b3e Deployed Nov 30, 2026 by nickvigilante via preview / deploy preview #136
Preview — e7ab9bea Deployed Nov 30, 2026 by vercel[bot]
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.

3 participants