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

Hide Notification Banner with Scroll Threshold and Device Normalisation Functions #4295

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shannonmcgurk
Copy link

@shannonmcgurk shannonmcgurk commented Jul 3, 2024

What does this change?

This change improves the transient notification banner's behaviour by introducing a function to hide the banner after the user performs certain actions: when the user presses the up arrow, the down arrow, or scrolls using the mouse wheel or trackpad. The scroll threshold is set at a magnitude of 10, ensuring that the banner remains visible during minor or accidental scrolls. A function to normalise the wheel action of the scroll has also been implemented to ensure a consistent user experience across different devices and browser settings.

How should a reviewer test this change?

Trigger the transient notification banner to appear.
Press the up arrow or down arrow and confirm that the banner hides.
Scroll using the mouse wheel or trackpad with a magnitude below the threshold (10) and confirm that the banner remains visible.
Scroll using the mouse wheel or trackpad with a magnitude above the threshold (10) and confirm that the banner hides.
Test the behaviour across different devices and browsers to verify the normalisation function works correctly.

Tested? Documented?

  • locally by committer
  • locally by Guardian reviewer
  • on the Guardian's TEST environment
  • relevant documentation added or amended (if needed)

@shannonmcgurk shannonmcgurk changed the title all work relating to notification banner sensitivity Enhance Notification Banner Hide Function with Scroll Threshold and Device Normalisation Jul 3, 2024
@shannonmcgurk shannonmcgurk changed the title Enhance Notification Banner Hide Function with Scroll Threshold and Device Normalisation Hide Notification Banner Hide Function with Scroll Threshold and Device Normalisation Jul 3, 2024
@shannonmcgurk shannonmcgurk changed the title Hide Notification Banner Hide Function with Scroll Threshold and Device Normalisation Hide Notification Banner with Scroll Threshold and Device Normalisation Functions Jul 3, 2024
@shannonmcgurk shannonmcgurk marked this pull request as ready for review July 3, 2024 15:38
@shannonmcgurk shannonmcgurk requested a review from a team as a code owner July 3, 2024 15:38
@paperboyo paperboyo added the bbc label Jul 3, 2024
Copy link
Contributor

@Conalb97 Conalb97 left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

Copy link
Contributor

@KaliedaRik KaliedaRik left a comment

Choose a reason for hiding this comment

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

Tested in local and can confirm the immediate functionality works as intended:

  • transient lifespan banners disappear on user interaction
  • session and persistent banners remain in view until user directly interacts with them

Two thoughts for consideration.

  1. The Grid includes additional keyboard navigation, specifically: PgUp, PgDown, Home and End keys. For a consistent user experience, should these keys also be included alongside the arrow and esc keys to dismiss the banners?

  2. During testing in local, I noticed that transient/session banners automatically reappear a short while after being dismissed - see screen capture below; this does not affect persistent banners (due to user interaction with those messages leading to the addition of a cookie to the user's device?). This may be due to testing on my local but, if not, perhaps some additional documentation and - if necessary - fixes for this sub-optimal user experience could be added to the PR?

Screen.Recording.2024-07-09.at.10.55.11.mov

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

Successfully merging this pull request may close these issues.

4 participants