Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(components): menu item only changes color on focus-visible #2327

Merged
merged 7 commits into from
Jan 22, 2025

Conversation

chris-at-jobber
Copy link
Contributor

@chris-at-jobber chris-at-jobber commented Jan 21, 2025

Motivations

Bring the menu items more in line with our overall pattern for focus states.

Changes

Changed

  • Menu items only change color when they are focused by keyboard
  • Uses shadow-focus instead of outline on focus-visible
Screen.Recording.2025-01-21.at.3.20.12.PM.mov

Testing

Open a menu with your mouse vs with your keyboard

Changes can be
tested via Pre-release


In Atlantis we use Github's built in pull request reviews.

Random photo of Atlantis

Copy link

cloudflare-workers-and-pages bot commented Jan 21, 2025

Deploying atlantis with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f6d447
Status: ✅  Deploy successful!
Preview URL: https://fc7e1403.atlantis.pages.dev
Branch Preview URL: https://update-focus-style-for-menu.atlantis.pages.dev

View logs

text-align: start;
background-color: transparent;
cursor: pointer;
gap: var(--menu-space);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This re-order happened via auto-fix

@@ -65,24 +65,26 @@

.action {
display: flex;
gap: var(--menu-space);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

width: 100%;
padding: var(--menu-space);
border: none;
border-radius: var(--radius-base);
outline: transparent;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beacuse we're using box-shadow on focus, this sets outline to transparent so that high-contrast modes still work.

}

.action:hover,
.action:focus {
.action:focus-visible {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

focus-visible respects browser heuristics for what should and not be focused

@chris-at-jobber chris-at-jobber marked this pull request as ready for review January 21, 2025 22:30
@chris-at-jobber chris-at-jobber requested a review from a team as a code owner January 21, 2025 22:30
@nad182 nad182 self-requested a review January 21, 2025 22:32
Copy link
Contributor

@nad182 nad182 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving, since my suggestion is non-blocking. But I think it would be nice to add transition for box-shadow as well to have it "synced" with background-color.

Co-authored-by: Nazarii L <nazarii.l@getjobber.com>
@chris-at-jobber
Copy link
Contributor Author

@nad182 added it, great suggestion!

Copy link
Contributor

@nad182 nad182 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@chris-at-jobber chris-at-jobber merged commit 99ba0ed into master Jan 22, 2025
13 checks passed
@chris-at-jobber chris-at-jobber deleted the update-focus-style-for-menu-item branch January 22, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants