-
Notifications
You must be signed in to change notification settings - Fork 1k
USWDS - Header: Search input appears last in menu for mobile header. #6037
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
Conversation

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cathybaptista! The headers are looking consistent across the board.
One minor change to add an empty line before the anchor declaration

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
- Header search placement is consistent across variants
- Tab order matches expectation
Important
We'll want to mark this change our release notes. If we offer the suggestion to reapply order via CSS, we should flag that it goes against accessibility guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this work @cathybaptista! I confirmed that the tab order now matches the visual order.
I noticed that the vertical margins between mobile nav elements are a bit different across variants. Can you update the margins in the Default variant above the search bar and primary navigation to align with the margins in the Extended megamenu variant? I've highlighted the differences in the screenshot below:
Hi, @amyleadem! 2785b67 resolves spacing above the search bar and 3a6c114 resolves spacing. Thank you SO MUCH for all of your help with this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cathybaptista.
I noticed that there is still a difference in the spacing between the search bar and link list. The basic variant has a margin-top of .5rem while the extended has a margin-top of 1rem.
Instead of the changes you made to usa-header.scss
, I'm wondering if we can use the margin-top
rule from .usa-nav__secondary .usa-search
(line 342 of usa-nav.scss) and make it so that it applies more generically (potentially line 113 of the same file). Curious what you think!
3a6c114
to
7e420b6
Compare
@amyleadem, I think this is a great idea! Ensures the top margin is consistent. :) check out 7e420b6 and http://localhost:6006/?path=/story/components-header--extended |
Changes have been made since approval. Needs re-review.
There was a problem hiding this 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! Thanks @cathybaptista
@mahoneycm I am clearing your review since some changes have been made since you last saw it. Can you take another look when you get a moment?
…ds/uswds into cb-remove-order-from-usa-nav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a regression in desktop views! Would you mind looking into this?
…r megamenu and default.
@aduth it looks like it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
…ds/uswds into cb-remove-order-from-usa-nav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cathybaptista nice job.
Functionally, everything looks and works well. Tested on both mobile and desktop breakpoints. No issues found with tabbing. One minor note to confirm on the header margin — I can approve once confirmed.
I've also updated the PR description to link the other issues that this feature closes.
- Closes #5971
+ Closes #5971, closes #3526, closes #3920.
Thanks for flagging that @aduth.
@@ -150,7 +151,7 @@ $z-index-overlay: 400; | |||
.usa-nav { | |||
@include u-flex("row", "align-center", "justify-end"); | |||
display: flex; | |||
padding: 0 0 units(0.5) units(1); | |||
padding: 0 0 units(1) units(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: The clarity of this is nice. We can shorthand, but this approach seems better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to successfully test and confirm that the search input appears last.
I compared the feature branch with what's currently on develop. Before/after links below.
Before | After |
---|---|
Develop | Feature branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is probably technically a breaking change because of the UX and design implications — but it might be worth noting that I don't believe teams will have to make any changes to their code to make this work, so change does not introduce a breaking change on the code side
I approve this PR, but we may want to double-check the changelog entry and release notes. |
@thisisdano Added a suggestion to the changelog in an attempt to clarify the user action for the breaking change here. Once we figure out a solution in the changelog, we can include the changelog in the release notes and PR description. |
Summary
Removed the CSS order property from mobile header navigation. Now, the visual order of the component matches the tab order.
Details
This change visually moves the search bar to appear last in the list of menu items in the mobile header. This change results in the header being compliant with WCAG criterion 2.4.3 (Focus order) in mobile view.
Breaking change
This change causes the search bar to appear at the bottom of the menu. If you would like to visually keep the search bar at the top of the menu, you will need to reorder your markup in the mobile view.
Related issue
Closes #5971, closes #3526, closes #3920.
Related pull requests
Changelog uswds/uswds-site#2798
Preview link
Preview link: Header Component
Problem statement
Summarize the problem this PR solves in a clear and concise statement.
Web pages should be able to be navigated in an order that preserves meaning and operability. Currently, the tab order in the mobile header menu does not match the visual order. Therefore, the component does not meet WCAG criterion 2.4.3 (Focus order).
Solution
By removing the
order: 2; style
from.usa-nav__primary
, the search bar appears at the bottom of the menu in the mobile header, maintaining tab order and preserving meaning. This approach was chosen based on a conversation in dev sync on 8/6/24. This will impact users that wish to visually keep the search bar at the top of the menu; these users will need to reorder their markup in the mobile view.Testing and review
I am looking for confirmation that the tab order makes sense and that it is consistent with WCAG criterion 2.4.3 (Focus order),
git pull origin [base branch]
to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch isdevelop
).npm run prettier:sass
to format any Sass updates.npm test
and confirm that all tests pass.