Skip to content

fix: Show button focus styles only when needed#648

Merged
gnapse merged 1 commit intomainfrom
ernesto/button-focus-visible
Apr 13, 2022
Merged

fix: Show button focus styles only when needed#648
gnapse merged 1 commit intomainfrom
ernesto/button-focus-visible

Conversation

@gnapse
Copy link
Copy Markdown
Contributor

@gnapse gnapse commented Apr 13, 2022

Short description

In our products today, when you click a button with the mouse, it stays visually as if hovered, even when you moved the mouse out of it. This is because buttons stay focused after clicked, and we have this rule that hover and focus states show visually the same. This is, of course, disruptive to mouse-centric users, who do not expect that unhovering leaves the button as if "engaged".

Here we're switching from :focus to :focus-visible, which automatically and transparently fixes this issue. Browser support is already good enough (all latest versions of all major supported browsers already support this, and while we may still support older versions of these browsers that do not yet support this CSS pseudo-selector, this is acceptable as it is not super disruptive, and any user who complains only need to upgrade their browser of choice).

PR Checklist

  • Added tests for bugs / new features
  • Updated docs (storybooks, readme)
  • Executed npm run validate and made sure no errors / warnings were shown
  • Described changes in CHANGELOG.md
  • Bumped version in package.json and package-lock.json (npm --no-git-tag-version version <major|minor|patch>) ref
  • Updated all static build artifacts (npm run build-all)

Versioning

Patch release.

@gnapse gnapse added Component:Button Versioning:Bug-Fix PRs that would result in a patch version release Ship without review labels Apr 13, 2022
@gnapse gnapse self-assigned this Apr 13, 2022
@gnapse gnapse merged commit de899d3 into main Apr 13, 2022
@gnapse gnapse deleted the ernesto/button-focus-visible branch April 13, 2022 13:27
@gnapse gnapse mentioned this pull request Apr 19, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component:Button Versioning:Bug-Fix PRs that would result in a patch version release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant