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

Navigation: Explore clearer focus style that doesn't look like an active section, and don't show on mobile #372

Closed
jasmussen opened this issue Mar 27, 2023 · 2 comments · Fixed by #373
Assignees

Comments

@jasmussen
Copy link
Collaborator

From WordPress/wporg-main-2022#221

(Mobile) News is permanently underlined, even when other instances are active.

Here are screenshots. Homepage:

Screenshot 2023-03-27 at 13 36 21

Download page:

Screenshot 2023-03-27 at 13 36 41

In both cases here, "News" is underlined.

Technically this happens because the overlay menu is a modal dialog, which has to set focus on the first menu item. In other words, the underline represents the focus style. To rectify this, let's do two things:

1. Don't show this focus style on a touchscreen device, where you can't use tab to navigate anyway

We can very probably hide it using code like this:

@media (hover: none) {
	.classname:focus {
	   ...
	}
}

Let's separately explore a better focus style that can ideally be generic and the same across the entire website, and look more like a focus style. A quick mockup in the inspector:

Screenshot 2023-03-27 at 13 46 07

  • The above reduces the padding of top level menu items, increases on the menu container instead
  • It adds a pseudo element on focus, and inside that pseudo element draws a box-shadow.
  • This is so the focus style can have a 2px rounded radius.
  • Specific metrics of the shadow are: box-shadow: 0 0 0 1.5px #7b90ff.
  • Can use light blueberry on dark backgrounds, regular blueberry on light backgrounds.

This focus style is the same inside the block editor.

@ryelle
Copy link
Contributor

ryelle commented Mar 27, 2023

Don't show this focus style on a touchscreen device, where you can't use tab to navigate anyway
We can very probably hide it using code like this:

You can still use a keyboard with a touchscreen device, so we should not hide the focus like this. Instead, we can try using :focus-visible which shows the focus only when the browser determines a keyboard is used. That should work, because the real focus indicator (the dotted line) is added using :focus-visible and it's not there until I start tabbing.

Screenshot 2023-03-27 at 12 56 57 PM

@jasmussen
Copy link
Collaborator Author

Instead, we can try using :focus-visible which shows the focus only when the browser determines a keyboard is used

Sound good!

@ryelle ryelle transferred this issue from WordPress/wporg-main-2022 Mar 28, 2023
@ryelle ryelle self-assigned this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants