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

Global Header: Add in styles to fix older browsers. #178

Merged

Conversation

StevenDufresne
Copy link
Contributor

@StevenDufresne StevenDufresne commented Mar 7, 2022

This PR copies in Gutenberg Navigation styles that include the :where CSS declaration which causes unusable layouts in older browsers.

Fixes #159

Why does Gutenberg use :where?

Gutenberg uses these conditional css selectors because the Navigation component has a "Open on click" feature:

When that feature is toggled on, the hover functionality is not added to the submenus.

What are the risks?

There isn't much risk since the CSS is implemented behind the supports declaration, however:

  • Should we ever turn on "Open on Click" for the menu, these changes will not work for that.
  • We carry forward some technical CSS debt in an "active" CSS file.

Screenshots

Environment: Windows 8.1 - Chrome 69

Before After

Incidental Changes

  • In order to use @supports, we need to update postcss-preset-env. The current version is using an older autoprefixr version that does not support @supports.

How I tested this fix

  • Build global-header component
  • Copy style.css from build folder
  • Loaded Windows 8.1, Chrome 69 via Browserstack
  • Replace global-header-footer style.css source via chrome inspector tools with copied source.

I also did the same thing using the Falkon browser in a virtual machine.

@StevenDufresne StevenDufresne marked this pull request as ready for review March 7, 2022 06:17
@StevenDufresne StevenDufresne requested review from iandunn and ryelle March 7, 2022 06:17
@StevenDufresne StevenDufresne force-pushed the fix/header-in-old-browsers branch from 6fbc270 to fcf6262 Compare March 7, 2022 06:57
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

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

Visually this looks good (tested on Chrome 87), but the dropdowns can't be accessed by keyboard anymore. I think you can use :focus-within on the same element as :hover, but maybe double check the browser support.

@StevenDufresne
Copy link
Contributor Author

Visually this looks good (tested on Chrome 87), but the dropdowns can't be accessed by keyboard anymore. I think you can use :focus-within on the same element as :hover, but maybe double check the browser support.

Thanks for catching that! I'll take a look.

@StevenDufresne
Copy link
Contributor Author

Ok, using focus-within seems to work with chrome. 👍

I tested all the way back to Chrome 68. However, Falkon in my Virtual Machine won't tab into the navigation at all, which is a bit bizarre. It should work... 🤔

If we are okay with these changes, we could merge this PR, and reopen a new ticket with a smaller scope if that is still in fact a problem. It will give people a better ability to test these changes with little risk.

@ryelle ryelle self-requested a review March 8, 2022 17:41
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

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

Working with keyboard nav & screen reader (VO).

I left one comment that would be an improvement, but it's not a blocker since that's also how it works on production.

align-items: normal;
opacity: 0;
transition: opacity 0.1s linear;
visibility: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this rule necessary? Technically it removes the element from the accessibility tree, so it no longer shows up in VoiceOver's links menu. The links are still accessible on the page, it's just the menu in the rotor that's missing it.

@StevenDufresne
Copy link
Contributor Author

@ryelle Since #159 doesn't support selector support checks, any reservations just including the CSS for all browsers? I can't think of a good way to target CSS 4 selectors.

@ryelle
Copy link
Contributor

ryelle commented Mar 10, 2022

any reservations just including the CSS for all browsers?

The risks you identified would now apply to all browsers, rather than just the older ones. We'll need to maintain the CSS, so if the nav block markup changes, our CSS won't know about that. Honestly that's probably true for other things on the site too, so it's not a blocker.

@StevenDufresne StevenDufresne force-pushed the fix/header-in-old-browsers branch from a64abfa to 8d55a87 Compare March 11, 2022 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with the header links on Falkon browser
2 participants