Skip to content

USWDS - Header: Enable chevrons and add/remove icons to be visible in WHC/Forced Colors mode. Resolves #4453#4485

Closed
mahoneycm wants to merge 13 commits into
cm-high-contrast-a11yfrom
cm-chevron-mask-mixin
Closed

USWDS - Header: Enable chevrons and add/remove icons to be visible in WHC/Forced Colors mode. Resolves #4453#4485
mahoneycm wants to merge 13 commits into
cm-high-contrast-a11yfrom
cm-chevron-mask-mixin

Conversation

@mahoneycm

@mahoneycm mahoneycm commented Jan 28, 2022

Copy link
Copy Markdown
Contributor

Preview

Headers →

Description

Resolves #4453.

This PR uses the place-icon mixin to create a CSS mask for the Header navigation icons and enables them to be visible in WHC using @media (forced-colors: active) {background-color: ButtonText;}

Additional information

Currently:
image

After Fix:
image

Bonus Mobile view:
image

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.

@mahoneycm mahoneycm requested a review from mejiaj January 28, 2022 21:43
@mahoneycm

Copy link
Copy Markdown
Contributor Author

I noticed the close button was disappearing on mobile while in WHC. Using the same solution as the chevron, I was able to replace the inline svg with place-icon and add the forced colors media query to remedy this!


Before:

image

After:

image

@brunerae brunerae mentioned this pull request Feb 14, 2022
4 tasks
@mahoneycm mahoneycm mentioned this pull request Feb 14, 2022
8 tasks
@mahoneycm mahoneycm changed the base branch from develop to cm-high-contrast-a11y February 24, 2022 16:35

@thisisdano thisisdano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work!

@mejiaj mejiaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks and works pretty well. Thank you!

Some additional improvements we could make:

  • Add some HCM styles to the navigation bar [_add-bar.scss] (used in usa-current here and in sidenav)
  • Add a background or border to the search button for HCM only

$nav-link-arrow-icon-size: 2;

// Maps for icon masks
$place-icon: (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's rename this to something more obvious like $place-icon-defaults.

)
);

$mobile-icons: map-merge(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's also update here for readability $mobile-icon-defaults.

$after: "after";
$before: "before";
$icon-margin: "auto";
$vertical-align: "auto";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's remove these variables and just add these to each implementation. That way we can easily change 1 without affecting the other.

$after: "after";
$before: "before";
$icon-margin: "auto";
$vertical-align: "auto";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't believevertical-margin: auto has any meaning. Do you mean middle?

Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align

@amyleadem

amyleadem commented Mar 21, 2022

Copy link
Copy Markdown
Contributor

@mahoneycm
Visual note: In standard mode, there is a difference in color for the expand icons. develop currently shows the icons as black, in this PR the colors are gray and blue.
image

@mahoneycm

Copy link
Copy Markdown
Contributor Author

Closed in favor of #4604

@mahoneycm mahoneycm closed this Mar 25, 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.

Chevron on primary menu items may not meet contrast criteria in Windows high contrast/forced colors mode

4 participants