Repository navigation
fix(EmptyButton): show a focus ring on keyboard focus - #1344
Merged
XOP merged 3 commits intoDec 2, 2026
Merged
Conversation
Co-authored-by: Gareth Jones <305167+gjones@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
@chad-agent could you please include screenshots? |
Contributor
|
@mdevils he can't ( I will be meat proxy for now. Screenshots are uploaded The ring is the one |
mdevils
approved these changes
Dec 2, 2026
ignovak
approved these changes
Dec 2, 2026
While the Flyout width animation runs, the narrow body overflows and Chromium makes it a Tab stop. Three Tabs then ended on Test Primary instead of the close button. The test now waits for the dialog's animations to finish before it presses Tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ring The ring on the close button is the intended look, confirmed in review (AGENTS.md section 8). A dialog focuses its close button on open, so 25 snapshots of EmptyButton, Dialog and Flyout now show the ring. Against main rendered in the same image, only pixels inside the ring box change. Nine of the files also pick up drift below the Playwright threshold that main already has. The new files match the CI screenshots of this branch pixel for pixel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Close buttons in dialogs now show a ring when you reach them with the keyboard.
Dialog,ConfirmationDialogandFlyoutshowed nothing when it had keyboard focus.IconButton: blue in light mode, yellow in dark mode.Description
EmptyButtondrew no focus indicator. It now draws a 2px ring (--click-global-color-outline-default, offset 2px) on:focus-visible.Dialog,ConfirmationDialogandFlyoutclose buttons show theIconButtonring. TheCollapsibletrigger keeps the fix(Collapsible): show focus ring on keyboard focus of the trigger #1312 ring.dialog.spec.tsandflyout.spec.tsgot a Tab test foroutline-style: solid. Both fail onmain.Links and tickets
SidebarCollapsibleItem.Good to know
main, only ring pixels change (list under Accessibility).EmptyButton.:where(). This file already uses it, so class rules can still override the ring.Checklist
Not breaking: no prop, type or export changes. Visual: the close buttons of
Dialog,ConfirmationDialogandFlyoutshow a ring on keyboard focus; the changeset says so and says what to check. No design review: it is the ringIconButtonalready uses, from the--click-global-color-outline-defaulttoken.Contribution
buildandbuild-storybookwork locallyNot done: a manual check in the Storybook UI. I checked the ring with a Playwright probe on static Storybook builds instead (see Accessibility). No story changed.
Accessibility
aria-labelVision is ticked for the close buttons in this PR: the ring color is a token, the ring shows, and the buttons are 32×32 px (28×28 px in the inline
Flyout). Keyboard is not ticked: I tested that Tab reaches the close button and that focus is visible, but not Enter, Space, Escape or focus return, which this PR does not change. Names is not ticked: theDialogclose button has no name onmain. #1322 "fix(Dialog): name the header close button and forward its test id" fixes it.WCAG 2.2 criteria checked: 2.4.7 Focus Visible (AA), 1.4.11 Non-text Contrast (AA) for the ring.
Tested (Chromium 159 in
mcr.microsoft.com/playwright:v1.65.1-noble, static Storybook builds ofmainc39edcf and this branch, light and dark):display-dialog--modal-dialog,display-dialog--only-close,display-confirmationdialog--with-close,display-flyout--open-default,display-flyout--inline-type.main:outline-style: none, and the focused and unfocused screenshots are byte-identical, so nothing marks focus.#437eef, 3.84:1 against the#ffffffdialog background. Dark:#faff69, 15.40:1 against#1f1f1c(Dialog) and 13.74:1 against#282828(Flyout).SidebarCollapsibleItemandSidebarCollapsibleTitle, focus and focus with hover): same result on both sides, the inset ring from fix(Collapsible): show focus ring on keyboard focus of the trigger #1312, 3.40:1 or more in light, 12.66:1 or more in dark, no clip. Screenshots byte-identical.mainand pass on this branch.yarn test:visualcannot build its image here, so I ran the same specs in the stock image withCI=true. The 25 updated baselines:emptybutton-focus-light(1). The old baseline shows the focused button with no ring.dialog-modal,dialog-with-description,dialog-only-close,dialog-reduce-padding, light and dark (8).flyout-open-default,flyout-inline-type,flyout-align-start,flyout-no-shadow,flyout-size-narrow,flyout-size-wide,flyout-size-widest,flyout-body-align-top, light and dark (16).mainrendered in the same image, only ring pixels change. 9 of them also pick up drift thatmainalready has, below the Playwright threshold and outside the ring: 7dialogfiles,flyout-align-start-darkandflyout-size-wide-dark.mainrendered in this image differs from its own baselines in 12 files.mainand this branch, taken with the specs' own steps and compared directly: every changed pixel is inside the ring box around the close button (40×40 px, 36×36 px forinline-type).mainagainstmaingives 0 changed pixels.title-only,no-headerandchat-dialoghave no close button and show 0 changed pixels. All 6ConfirmationDialogstories show 0 changed pixels too, because the close button does not have focus when they open.eslint-suppressions.jsondid not change.Repro without my tools: open
iframe.html?id=display-dialog--only-close&globals=theme:light, press Tab once, and look at the edge of the close button.Not tested:
Screenshots
🤖 Generated with Claude Code
Note
Low Risk
Small CSS accessibility fix on a shared primitive; main risk is expected visual snapshot updates when dialogs open with focus on the close control.
Overview
EmptyButton now paints a keyboard focus ring (
:focus-visible, 2px--click-global-color-outline-default, offset 2px) via a zero-specificity:where()rule so consumers like CrossButton can still override it.That restores visible focus on close buttons built on EmptyButton in Dialog, ConfirmationDialog, and Flyout—matching IconButton—where the base style had removed the outline entirely. Playwright accessibility tests in
dialog.spec.tsandflyout.spec.tsassertoutline-style: solidafter Tab; visual snapshots that catch dialogs right after open may show the ring because focus lands on the close button.Reviewed by Cursor Bugbot for commit 021db6b. Bugbot is set up for automated code reviews on this repo. Configure here.