Repository navigation
feat: add MD3 keyboard focus indicators - #5107
Merged
Merged
Conversation
k0ndee
force-pushed
the
@k0ndee/focus-indicators
branch
from
September 9, 2026 06:45
41c8801 to
e1f7d10
Compare
k0ndee
force-pushed
the
@k0ndee/focus-indicators
branch
from
September 23, 2026 08:25
e1f7d10 to
737b751
Compare
This was referenced Oct 30, 2026
The snapshots carried over from the pre-rebase commit didn't account for the per-component hitSlop changes now merged in from 48dp-touch-targets.
Tabs fill the bar edge to edge and the bar clips (`overflow: 'hidden'`), so the default outward ring lost its top and bottom and showed only as vertical lines between tabs. Pass `focusRing: 'inward'` to `renderTouchable` and forward it explicitly in the default `Touchable` so it does not leak to the iOS `Pressable` fallback.
MD3 and Material Web ring chips outward (3dp, 2dp gap). The chip body was inward so a scrolling chip row could not trim it, but that clip belongs to the app's container, not to the chip, so the chip follows the spec.
Material Web rings the remove button with a circle around the icon. The ring was a rounded rectangle around the whole 34dp close column from callstack#5108, reaching the label. Focus still lands on the column, so its touch target is unchanged; the ring is drawn outward on a 24dp circle (4/3 of the 18dp icon, like Material Web) inside it, through the 'descendant' scope.
Checkbox.Item is a full-width row, like List.Item and RadioButton.Item, which already ring inward. An outward ring ran into the rows above and below it.
List.Accordion is a full-width row like List.Item, which already rings inward, so the two were inconsistent and the accordion's outward ring ran into the rows around it.
Menu items fill the menu's scroll view edge to edge with no gap between them, so an outward ring was clipped by the menu and ran into the neighbouring items. Material Web rings menu items inward too.
Collaborator
On Android and iOS the ripple keeps its own height at the top of a chip that style makes taller, so a ring drawn on it sat high. It also sat inside the chip's 1dp border, so its gap to the visible edge was 1dp, not 2dp. The ring now goes on the Surface, as on Card, and the ripple only takes focus.
secondary has 2.04:1 contrast on the snackbar's inverseSurface in the light theme and 1.32:1 in the dark one, below the 3:1 a focus indicator needs. inversePrimary, the action label's color, has 7.73:1 and 4.97:1. An internal context sets the ring color for those two controls only, so there is no new prop and nothing else changes color.
Button, Card, the Chip body, FAB, FAB.Extended and the FAB.Menu trigger and items draw their ring on a parent with a :has() rule, and hid the browser outline on the focused element with an inline style. In a browser without :has() (Chrome before 105, Safari before 15.4, Firefox before 121) they showed no focus indicator at all. The shared stylesheet now hides that outline, inside a supports block that tests for :has(), so those browsers keep their own outline. It is important, as the inline style was, so an app's own outline rules still don't add a second indicator. The outline is drawn inside the edge, so the FAB clip views don't cut it off.
Doberjohn
approved these changes
Nov 16, 2026
alpharius-ck
added a commit
that referenced
this pull request
Nov 16, 2026
Take main's shared keyboard focus ring (#5107): - drop src/utils/focusRing.ts and take main's FAB, Switch and Checkbox - drop IconButton's own focus state and ring view; the ring now comes from useFocusRing with 'within' on the clip view, so it surrounds the outline and the touchable no longer draws a second one - keep the theme props on IconButton's TouchableRipple and TextInput.Icon - regenerate snapshots, add IconButton focus ring wiring tests Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
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.




























Motivation
Most components had no keyboard focus indicator, and FAB, Checkbox and Switch each drew their own. This adds one shared MD3 ring (3dp, 2dp offset,
secondary, keyboard only) on web and Android. Details and more screenshots are in a comment.Related issue
Fixes #5083. Supersedes #5084.
Screenshots / Videos
mainTest plan
On web (Chrome) and Android (hardware keyboard), Tab through each component: the ring shows on keyboard focus only, not after a click or touch. iOS shows no ring.