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

SPIKE: Make real-time banners dismissible if allowed #20064

Open
1 of 10 tasks
Tracked by #19466
eselkin opened this issue Dec 9, 2024 · 7 comments
Open
1 of 10 tasks
Tracked by #19466

SPIKE: Make real-time banners dismissible if allowed #20064

eselkin opened this issue Dec 9, 2024 · 7 comments
Assignees
Labels
Facilities Facilities products (VAMC, Vet Center, etc) sitewide VA.gov frontend CMS team practice area

Comments

@eselkin
Copy link
Contributor

eselkin commented Dec 9, 2024

NOTE: The below details may be obsolete. Ignore if they don't reflect reality upon inspection.

Background

When making the QA plan for Real-time banners, Laura discovered an existing bug on the VAMC Banners in Prod where they were not respecting the dismissible checkbox in Drupal. Even if a banner was set as dismissible, the X icon would not show on the FE.

This was brought up early during the implementation process and it was determined that we could easily add this to the new, real-time banners as a "quick win" to get it working properly

However, during testing unfortunately we determined this wasn't quite as simple as we hoped. Because of this complication and because this is not a regression from prod, it was decided that the dismissibility of banners would remain as it was in prod and this ticket was created to tackle it later

Description

Currently va-banners using the real-time API (vets-website situation update banners) cannot use the showClose value.

Dismissibility is disabled on full-width banners using the real-time banners API due to the use of dangerouslySetInnerHTML breaks the ability for the va-banner component to check if the banner is in localStorage.DISMISSED_BANNERS.

(dangerouslySetInnerHTML is required, in order to preserve rich-text content from Drupal that may include links.)

User story

AS A user
I WANT to be able to dismiss banners from the real-time API if they are allowed to be dismissed
SO THAT I don't get repeated banners (or unhideable banners)

Engineering notes / background

va-banner checks if text matches the banner, but text stored in the DISMISSED_BANNERS has the HTML from innerHTML as opposed to the text.

Acceptance criteria

  • Understand root cause of the ACs below not working as expected / what will be required in a code change in order to make them work.
  • Decide if issue can be fixed within the confines of this ticket or a new ticket should be made. If so, make that ticket.

If fixable:

  • If Drupal CMS value is set to make a VAMC Banner with Situation update dismissable, the banner component uses DST dismissable treatment
  • Clicking the dismissable "Close" button (X in a circle) renders the banner not visible on the FE of the website
    • The banner is present in the DOM
    • The banner does not contain content in the shadow DOM
  • A dismissed banner does not appear on page reload
  • A dismissed banner does not appear on other VAMC System pages
  • A dismissed banner is not read by a screen reader
  • The dismissed banner becomes visible again when the "DISMISSED_BANNERS" cookie is deleted
@eselkin eselkin added Needs refining Issue status sitewide VA.gov frontend CMS team practice area Facilities Facilities products (VAMC, Vet Center, etc) labels Dec 9, 2024
@jilladams
Copy link
Contributor

@laflannery I took a pass at ACs. It looks like in the DST Storybook, if you dismiss their component banner, the markup stays in the DOM. Just FYI, in case that comes up during AC review in refinement. (cc @Agile6MSkinner )

@laflannery
Copy link
Contributor

@jilladams The <va-banner> stays in the DOM but the shadow root is empty and that's what is important:
Image
I actually wrote this all up for the previous iteration of the QA test plan so maybe this will help for ACs?

When a dismissable banner is dismissed, a cookie is set with a key of "DISMISSED_BANNERS". When this is present:

  • The banner is not visible on the FE of the website
  • The banner will not be read by a screen reader
  • The banner is present in the DOM but without content in the shadow DOM
  • The banner becomes visible again when the "DISMISSED_BANNERS" cookie is deleted

@randimays randimays added Facilities Facilities products (VAMC, Vet Center, etc) and removed Facilities Facilities products (VAMC, Vet Center, etc) labels Dec 11, 2024
@jilladams jilladams changed the title Make real-time banners dismissible if allowed SPIKE: Make real-time banners dismissible if allowed Jan 3, 2025
@jilladams jilladams removed the Needs refining Issue status label Jan 8, 2025
@SnowboardTechie
Copy link

After digging into this, I don't believe we will be able to make real time banners dismissible without updating the core va-banner component so that the preparation of the BannerID could be done using an optional value passed into the component (i.e. bannerDismissedID) so that the banner can be identified prior to the vets-website's BannerContainer ever attempts to introduce the banner on page load.
I'll capture these thoughts more thoroughly in a new ticket.

@jilladams
Copy link
Contributor

It might be nice to ask the DST if they're open to that. If not, it's a no op. (They live in #platform-design-system in VA slack. Feel free to cc me and Michael if you want.)

@SnowboardTechie
Copy link

Great idea, thank you @jilladams! I went ahead and put the question out there

@Agile6MSkinner
Copy link

If we can't accomplish it, seems like we need to remove the option in Drupal so that editors don't think they are making a banner that is dismissible.

@SnowboardTechie
Copy link

Moving this to Review as I am awaiting further input from the DST prior to taking any next steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Facilities Facilities products (VAMC, Vet Center, etc) sitewide VA.gov frontend CMS team practice area
Projects
None yet
Development

No branches or pull requests

6 participants