systomic

Focus visible

:focus draws the ring on every click, so it ends up removed or toned down. :focus-visible shows it only to keyboard users, who actually need it.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • ErrorOxlint exits with a failure, so CI fails.
  • StylelintThe same check runs on .css and .scss files through the Stylelint plugin.
  • Autofixoxlint --fix fixes it for you.

See the difference

Before

Waiting for focus

className="focus:ring-2"
After

Waiting for focus

className="focus-visible:ring-2"

What doesn't work

Oxlint

2 findings

Stylelint

1 finding

What works

No findings

Oxlint

Stylelint

Details

focus:, group-focus: and peer-focus: (including named groups) are reported and fixed to their -visible variant. focus-within: is fine.

In StyleX, ":focus" keys inside stylex.create (also combined, like ":focus:hover") are fixed to ":focus-visible". Inline styles can’t express :focus.

Text inputs show focus for mouse users too, so input, textarea and select are ignored by default.

Option Default
ignoreElements ["input", "textarea", "select"]
attributes ["className", "class"]
callees ["cn", "clsx", "cx", "classnames", "twMerge", "twJoin", "cva", "tv"]

Stylelint

For .css / .scss files (see Stylelint): :focus in selectors and focus: in @apply, with autofix. input, textarea and select are ignored (ignoreSelectors, regex list).

See Styling for how classes, inline styles, StyleX and stylesheets are read.

Esc