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

va-alert: add full width functionality #1421

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

Conversation

jamigibbs
Copy link
Contributor

@jamigibbs jamigibbs commented Nov 26, 2024

Chromatic

https://3545-va-alert-site-wide--65a6e2ed2314f7b8f98609d8.chromatic.com

Description

This PR will add the USWDS alignment style and markup for a full-width site alert. This is activated when the full-width prop is set. Alert content will then align with the site width. Otherwise, the alert content will align left.

Since internally va-banner is just a wrapper for va-alert, this functionality will extend to that component too.

Closes department-of-veterans-affairs/vets-design-system-documentation#3545

QA Checklist

  • Component maintains 1:1 parity with design mocks
  • Text is consistent with what's been provided in the mocks
  • Component behaves as expected across breakpoints
  • Accessibility expert has signed off on code changes (if applicable. If not applicable provide reason why)
  • Designer has signed off on changes (if applicable. If not applicable provide reason why)
  • Tab order and focus state work as expected
  • Changes have been tested against screen readers (if applicable. If not applicable provide reason why)
  • New components are covered by e2e tests; updates to existing components are covered by existing test suite
  • Changes have been tested in vets-website using Verdaccio (if applicable. If not applicable provide reason why)

Screenshots

va-alert info closeable

alert-closeable

va-alert info not closeable

alert-not-closeable

va-alert info slim

Screenshot 2024-11-27 at 1 53 04 PM

va-alert warning closeable

alert-warning-closeable

va-alert warning responsive

alert-warning-closeable-responsive

va-banner closeable

banner-closeable

Acceptance criteria

  • QA checklist has been completed
  • Screenshots have been attached that cover desktop and mobile screens

Definition of done

  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)

@jamigibbs jamigibbs added the patch Patch change in semantic versioning label Nov 26, 2024
@jamigibbs jamigibbs changed the title va-alert & va-banner: add site wide functionality va-alert: add site wide functionality Nov 27, 2024
.usa-site-alert .usa-alert.usa-alert--error {
background-color: var(--vads-color-error-lighter);
border-left-color: var(--vads-color-error);
}
Copy link
Contributor Author

@jamigibbs jamigibbs Nov 27, 2024

Choose a reason for hiding this comment

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

The USWDS usa-site-alert package only supports the info color variation. This is probably intentional because the site alert docs don't show other alert colors being options.

I'm assuming we want more flexibility to be able to use site wide alerts for warning, success, and error too. For that reason, I needed to add those colors here. At a minimum, I am aware of info and warning currently being used on vets-website. I'm not sure if success or error are wanted/needed but I'm including them in the styles for completeness.

@@ -151,7 +152,7 @@ export class VaAlert {
}

render() {
const { visible, closeable, slim } = this;
const { visible, closeable, slim, fullWidth } = this;
Copy link
Contributor Author

@jamigibbs jamigibbs Nov 27, 2024

Choose a reason for hiding this comment

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

The full-width prop already existed but it was not being used anymore. Maybe this happened when we transitioned to USWDS v3?

Anyway, I'm using it again but I'm unsure about the original description:

If true, the alert will be full width. Should be for emergency communication only.

Should "emergency communication" be updated to something like "urgent information" instead? I'm just looking at the USWDS site alert docs for guidance for that wording but I'll need feedback from the team to confirm.

Screenshot 2024-11-27 at 1 21 11 PM

<section
class={classesSiteAlert}
aria-label={this.el.getAttribute('data-label')}
role={this.el.getAttribute('data-role')}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm making an assumption that we still want aria-label and role on the parent element but I'm not totally sure that's correct now because the full width version is wrapped in a section element instead of a div.

@jamigibbs jamigibbs changed the title va-alert: add site wide functionality va-alert: add full width functionality Nov 27, 2024
@jamigibbs jamigibbs marked this pull request as ready for review November 27, 2024 20:04
@jamigibbs jamigibbs requested a review from a team as a code owner November 27, 2024 20:04
Copy link
Contributor

@powellkerry powellkerry left a comment

Choose a reason for hiding this comment

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

LGTM, you may want to get design and accessibility approval for colors and aria-label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Patch change in semantic versioning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: va-alert content no longer aligns to site content width
2 participants