Repository navigation
fix(focus): no outline on text fields, a muted keyboard ring, keycaps that fit filled buttons - #37
Merged
Merged
Conversation
Browsers match :focus-visible on a text field however it was focused, so every click into an Input, Textarea or InputGroup drew the 2px ring. Text inputs, textareas, contenteditable and role=textbox are now excluded from the global rule, and a field shows focus with its border in the ring's colour. Everything else keeps the keyboard ring: 2px of --ring, now offset 2px so it is measured against the surface and never touches a filled control's edge.
The ring was the ink (white, black) or the full accent. It is now a muted tone that clears 3:1 on every surface, including a pressed popover row: atlas #808080 / #757575, atlas-mono dark #8f8f00, chyral dark #9f8047, phosphor dark #c27100. The light variants of atlas-mono, chyral and phosphor were already muted and are unchanged. Ported themes keep their own ring.
A plain keycap is a card-coloured box in a muted ink, which on a white primary or a red destructive button read as a hole. Inside those two variants a Kbd now draws in the button's text colour, thinned for its fill and edge. Other variants keep the plain cap. New story: WithKeycaps.
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.
Two visual bugs, both seen in Atlas desktop.
Text fields drew a thick white outline
:focus-visiblematches a text field on every focus, mouse andautoFocusincluded, so the global 2px ring (pure white in Atlas dark) drew around every Input, Textarea and InputGroup on click.The rule now (decision 31, in
utilities.css):input(text types),textarea,[contenteditable]and[role=textbox]are excluded from the global rule.Input,Textarea,InputGroup,ComboboxChipsand theDataTablesearch lift their border to--ringon focus instead. That border clears 3:1 against the field's fill, whereborder-strongwas about 1.8:1.--ring, offset 2px (was 1px). The gap is the surface colour, so the ring's contrast is measured against the surface, and it never runs into a filled control's edge.A muted ring in the Atlas themes
#ffffff#808080#000000#757575#ffff00#8f8f00#c9a35a#9f8047#ff9500#c27100sidebar-ringfollows. The light variants of atlas-mono, chyral and phosphor (#8a7500,#8a6a1f,#a85f00) were already muted and pass at least 3.3:1 on the same surfaces, so they are unchanged. Ported third-party themes keep their own ring.Keycaps in filled buttons
A plain
Kbdinside adefaultordestructiveButton now draws in the button's text colour (border-current/25 bg-current/10 text-current), so it no longer reads as a hole in the fill.secondary, outline, ghost and link variants keep the plain cap. There is a newWithKeycapsstory showing every variant.Tests
Button/KeyboardFocuschecks the 2px ring with a 2px offset.Textarea/Clickedand InputGroup'sAutofocused/Clickedcheck for no outline and a ring-coloured border.bun run typecheck,bun run test(652),bun run test:storybook(856, axe colour-contrast included) andbun run format:checkall pass.