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

USWDS - Header: fix mobile menu shaded display #4817

Merged
merged 5 commits into from
Jul 18, 2022

Conversation

mejiaj
Copy link
Contributor

@mejiaj mejiaj commented Jun 15, 2022

Description

Fix mobile menu appearance for different CSS layouts. The menu now appears properly on layouts using flex or CSS grid. Closes #4409.

Additional information

Removed z-index from usa-header in 9c0653c. There's no position specified, so it doesn't make sense to have it by default. Removing this fixes the display issue because the value was lower than the nav overlay's z-index.

Other changes

  • Use consistent angle brackets for consistency (previously square brackets) - d805212
  • Allow individual page layout templates to accept overrides — required for adding a navigation to Documentation template without affecting the rest of the page layout templates - e6f1817

How to test

  1. Visit Documentation page template
  2. Verify nav is present
  3. Open inspector
  4. Add style="display: flex; flex-direction: column; to div#root
  5. Confirm navigation works on desktop
  6. Resize to get mobile menu
  7. Click on Menu button
  8. Confirm navigation displays properly

Also, didn't notice any side effects on the other nav variations but worth double-checking.

Browsers tested

  • Edge v103
  • Firefox v102
  • Safari v15 on OSX Monterey via Browserstack

Before you hit Submit, make sure you’ve done whichever of these applies to you:

  • Follow the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run npm test and make sure the tests for the files you have changed have passed.
  • Run your code through HTML_CodeSniffer and make sure it’s error free.
  • Title your pull request using this format: [Website] - [UI component]: Brief statement describing what this pull request solves.

Remove `_header.twig` settings so we can override individual templates.
Restoring to what this was previously, since escape filter now works
Remove z-index from `usa-header`. Its stacking context was **lower** than the modal. This is causing issues where the main nav, which is a child, disappears when using flex or grid on `<body>`.
@mejiaj mejiaj marked this pull request as ready for review June 15, 2022 21:34
@mejiaj mejiaj requested a review from amyleadem June 15, 2022 21:34
Copy link
Contributor

@amyleadem amyleadem left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the helpful writeup.

One small thing: I found a couple uses of square brackets for placeholders in the sign in template. Everything else looks solid.

Here are the items I tested:

  • Navigation is present
  • Placeholder elements are displayed consistently with angle brackets

Display types on #root:

  • Mobile navigation looks good with flex
  • Mobile navigation looks good with grid
  • Mobile navigation looks good with block

Header variants:

  • Default
  • Megamenu
  • Extended Megamenu
  • Extended

Browsers:

  • Safari
  • Firefox
  • Chrome

@mejiaj
Copy link
Contributor Author

mejiaj commented Jul 5, 2022

@amyleadem thanks for the feedback! I've updated _max.twig with the right brackets.

@mejiaj mejiaj requested a review from amyleadem July 5, 2022 16:58
Copy link
Contributor

@amyleadem amyleadem left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@mejiaj mejiaj requested a review from thisisdano July 6, 2022 14:19
Copy link
Member

@thisisdano thisisdano left a comment

Choose a reason for hiding this comment

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

Approved but lol at 23 files changed for one line of fix! :)

@thisisdano thisisdano merged commit 65b1480 into develop Jul 18, 2022
@thisisdano thisisdano deleted the jm-mobile-menu-shaded branch July 18, 2022 04:20
@mejiaj
Copy link
Contributor Author

mejiaj commented Jul 18, 2022

Approved but lol at 23 files changed for one line of fix! :)

Totally, that was my mistake. Will separate them out next time.

@thisisdano thisisdano mentioned this pull request Aug 5, 2022
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.

Mobile menu shaded when body display is not block
3 participants