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-Site - Banner: Remove duplicated styles so banner highlight shows completely on tab. #2743

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

cathybaptista
Copy link
Contributor

@cathybaptista cathybaptista commented Jul 5, 2024

Summary

Removed duplicate styles for .usa-banner__button from uswds-site that were also in uswds. Now, the banner appears with the highlight on all four sides when the user tabs to the banner.

Related issue

Closes #1962

Preview link

home page

Problem statement

This issue relates to being able to test issue #5013 (https://github.com/uswds/uswds/pull/5013)](jhancock532:banner-focus-outline-styles).

#1962 was opened to resolve duplicated styles in uswds-site vs uswds that were causing the banner focus to only appear on 1 side for mobile devices. Ideally, the banner focus appears on all sides.

Rendering only an underline border on focus causes confusion to users with vision difficulties who have scaled the page to 400% zoom.

Solution

Before:
Screenshot 2024-07-05 at 10 00 16 AM
After:
Screenshot 2024-07-05 at 10 43 34 AM

Remove duplicate styles in uswds-site that also appear in uswds so that the correct style is shown and not overridden.

This approach was chosen because there is no need to have those duplicate styles in uswds-site when they are already in uswds, especially if they cause issues.

Testing and review

  • Open preview link and compare it to https://designsystem.digital.gov/. The border should appear on all four sides.
  • Confirm that style changes for .usa-banner__button make sense confirm that nothing got removed from uswds-site that also does not exist in uswds.
  • Confirm visual regression.

To reproduce:

  1. pull the branch cb-remove-duplicate-uswds-styles
  2. this issue appears on the main page
  3. select the top banner (An official website of the United States government) and ensure that the blue outline appear on all four sides.
  4. I am just looking for confirmation that it works.

@cathybaptista cathybaptista marked this pull request as ready for review July 5, 2024 18:00
@amyleadem amyleadem changed the title USWDS-Site-banner-remove duplicated styles so banner highlight shows completely on tab. USWDS-Site - Banner: Remove duplicated styles so banner highlight shows completely on tab. Jul 5, 2024
Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

@cathybaptista Great start here Cathy! I left a couple change requests based on some regressions I noticed as well as additional styles we can remove.

I also have a question about the scope of the issue. Does this issue aim to address all duplicate styles in _uswds-theme-custom-styles.scss? Or is it scoped specifically to banner styles? If it's scoped to banner styles, should we address the additional duplications or are we primarily focusing on banner button?

In either case it look like there are additional styles we can potentially remove.

CC: @mejiaj since he is the issue submitter

css/_uswds-theme-custom-styles.scss Show resolved Hide resolved
css/_uswds-theme-custom-styles.scss Outdated Show resolved Hide resolved
css/_uswds-theme-custom-styles.scss Outdated Show resolved Hide resolved
@mahoneycm
Copy link
Contributor

From the issue:

@mahoneycm this is strictly scoped to duplicate banner styles.1

Sounds like we look at the additional banner classes with potential duplicate styles, such as usa-banner__header and others.

Footnotes

  1. https://github.com/uswds/uswds-site/issues/1962#issuecomment-2220740435

@cathybaptista
Copy link
Contributor Author

cathybaptista commented Jul 17, 2024

@mahoneycm , I was able to remove many styles. Here is the list. I have checked that these removals don't cause any problems that I can see, but I would love a more experienced eye on this just to be 100% sure I didn't remove a style that is causing issues.

SOOO many thanks!

.usa-banner__icon
.usa-banner__button-text
@include at-media-max("tablet") {
.usa-banner__inner
.usa-banner__header--expanded
.usa-banner__header-flag
@include set-link-from-bg(
.usa-banner__header
.usa-banner__inner
.usa-banner__lock-image
.usa-banner__guidance
$banner-icon-close:
@include at-media("tablet") {

@cathybaptista cathybaptista force-pushed the cb-remove-duplicate-uswds-styles branch from 9c7c0bc to e085c99 Compare July 18, 2024 01:57
@cathybaptista cathybaptista requested a review from mahoneycm July 18, 2024 14:39
Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

Hey there @cathybaptista! Getting closer. It looks like there are additional duplicate styles that we can remove. I tagged some that stood out to me.

Would you mind ensuring we can safely remove these and giving this another pass to see if there are additional styles that are safe to remove?

min-height: 0;
}
}

.usa-banner__header-text {
@include u-margin-y(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Removing this margin does cause any regression of styles. Margin is set to 0 in banner styles lines 157-158.

Suggested change
@include u-margin-y(0);

@@ -2906,11 +2840,6 @@ $theme-table-column-gap: 4;
middle,
$site-banner-background-color
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: These styles are required to maintain proper color contrast of the chevron in mobile views

Copy link
Contributor

Choose a reason for hiding this comment

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

Chore: Run npm run prettier:scss. This will help to cleanup some white space and minor formatting issues 👍

}

&[aria-expanded="false"] {
background-image: none;
}

&[aria-expanded="true"] {
background-image: none;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: We can remove the background-image here. It's declared in banner styles lines 286-290

Suggested change
background-image: none;

@include u-pin("right");
}
}

@include at-media("tablet") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: I'm unable to tag the correct lines because they are unedited but it looks like we can safely remove lines 2881-2887.

-    height: auto;
-    padding: units(0);
-    position: relative;
-    &:after {
-      position: absolute;
-    }

These are set in banner styles lines 332-338

$site-banner-background-color,
$site-banner-link-color,
$context: $banner-context
);

line-height: line-height($site-banner-font-family, 2);
margin-bottom: units(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Remove lines 2845-2855. Unable mark as a code suggestion due to unchanged lines.

-    margin-bottom: units(0);
-    margin-top: units(2px);
-    text-decoration: underline;
-    .usa-banner__header--expanded & {
-      display: none;
-    }
-    @include at-media("tablet") {
-      display: none;
-    }

Maintained by banner styles lines 172-182

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.

USWDS-Site: Remove duplicate banner styles
3 participants