Skip to content

USWDS - Banner: Support simplified icon markup using SVG mask#5829

Closed
aduth wants to merge 1 commit intouswds:developfrom
aduth:aduth-banner-bg-mask
Closed

USWDS - Banner: Support simplified icon markup using SVG mask#5829
aduth wants to merge 1 commit intouswds:developfrom
aduth:aduth-banner-bg-mask

Conversation

@aduth
Copy link
Copy Markdown
Contributor

@aduth aduth commented Mar 21, 2024

Summary

The Banner component markup has been simplified. The banner component no longer includes an embedded icon image, which is instead rendered as part of banner styles.

Breaking change

This is not a breaking change.

While this does change how the existing element is styled, this has been tested and confirmed support for a site which chooses to update to the newest styles while keeping the same HTML markup, and there is no observed visual regression.

Preview link

Preview link: http://localhost:6006/?path=/story/components-banner--default

Problem statement

Ideally, USWDS provides code snippets which are concise and easy to implement, do not needlessly duplicate existing resources, and are not at risk of falling out of sync with said resources.

Solution

Reference the existing lock.svg image CSS background mask, similar to what's done elsewhere in the banner with the "Here's how you know" expanding caret.

Benefits:

  • Simpler markup
  • More efficient page loads, since image will be referenced externally and loaded on-demand
  • Avoids use of non-BEM-standard icon-lock wrapping element
  • Backwards-compatible for sites which don't opt to change their existing markup

Testing and review

Review at preview link: http://localhost:6006/?path=/story/components-banner--default

To confirm backwards-compatibility, reset markup of .twig file to develop branch and observe no visual regressions even with updated styling:

git checkout develop -- packages/usa-banner/src/usa-banner.twig

@mejiaj
Copy link
Copy Markdown
Contributor

mejiaj commented May 20, 2024

Thanks for submitting this.

For additional context, this icon was originally added in Update banner settings and related mixins - #3531.

This icon is used between the parenthesis in Banner content (orange outline for visibility)

@mejiaj mejiaj added Status: Decided Against and removed Status: Triage Needs: Discussion We need to discuss an approach to this issue labels May 23, 2024
@aduth
Copy link
Copy Markdown
Contributor Author

aduth commented May 30, 2024

@mejiaj Thanks for the context. I see the label "Decided Against" was added. Was there something about the changes in #3531 which are contrary to or conflict with the proposed changes here?

@thisisdano
Copy link
Copy Markdown
Contributor

@aduth For right now, we're not proceeding with changes that might introduce a breaking change in the current banner. We're putting our focus into a Web Components version of the banner that we hope to release as a stable Beta in July.

@thisisdano thisisdano closed this Jun 7, 2024
@aduth aduth deleted the aduth-banner-bg-mask branch August 7, 2024 15:45
@aduth
Copy link
Copy Markdown
Contributor Author

aduth commented Aug 7, 2024

For posterity's sake, clarifying that there are no breaking changes with this proposal.

mejiaj pushed a commit to uswds/uswds-elements that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants