Replace outline-none
with outline-hidden
, add new outline-none
#14926
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.
This PR renames the existing
outline-none
utility tooutline-hidden
, and adds a new simpleroutline-none
utility that just setsoutline-style: none
.The existing
outline-none
utility doesn't actually setoutline: none
, and instead creates a 2px invisible outline:We implemented it this way because people often use
outline: none
to hide focus rings and replace them with custom shadow-based focus rings, without realizing that that approach leads to no visible focus ring in forced colors mode because box shadows aren't rendered in forced colors mode.While this is sort of helpful and clever, it can be a pain when you really do need
outline: none
, and I think it feels surprising in hindsight to hijack the name of an existing CSS property value and make it mean something else.The name
outline-hidden
feels better because it's a new keyword that CSS doesn't use for outlines, and implies that perhaps there's a bit more going on than just settingoutline-style: none
.This PR includes a codemod to convert any existing use of
outline-none
tooutline-hidden
, and we will be sure to explain whatoutline-hidden
does for you in the v4 documentation.Manually tested this in the Vite playground to make sure it behaves as expected 👍