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

Add notification banner #2025

Merged
merged 27 commits into from
Nov 19, 2020
Merged

Add notification banner #2025

merged 27 commits into from
Nov 19, 2020

Conversation

36degrees
Copy link
Contributor

This is a combination of several PRs which have already been reviewed and merged into the feature/notification-banner branch:

The notification banner work has been done using a 'feature branch' so that we can keep code reviews small whilst avoiding merging unreleasable work to the master branch. This PR merges that feature branch into master now that the notification banner work is ready to release.

This means that all of the individual changes have already been through one round of code review. To review this pull request, really all we want to check is that the changes are what we expect based on the above.

hannalaakso and others added 27 commits October 22, 2020 16:32
The header and links change colour based on if the notification banner is type: notification, success or error.
As part of the notification banner work, we introduced a new govuk-link-style-error mixin to automatically apply error colours to links (including visited and hover styles).

We should apply these styles to the error summary component so things are consistent.
The error summary doesn't currently have visited/hover styles for links, which isn't great, so this change adds those styles.
If a notification banner has `role="alert”`, add tabindex=“-1” to it so it can be focused and move keyboard focus to it with JavaScript for increased visibility to assistive technologies.

Don’t focus the banner if it has the data-disable-auto-focus attribute.
Test if the element has the correct tabindex and can be focused.

Test that element is not focused if it has the data-disable-auto-focus
attribute or it doesn’t have role=alert.
This is following some feedback from the GDS Accessibility clinic: #1999 (comment)
There is no need for the component to be focusable after the page has loaded.

Only remove the tabindex attribute if it was set by JavaScript.
Also test that if the tabindex wasn't added with JavaScript, it doesn't get
removed by the script.
…index-on-blur

Remove tabindex attribute from notification alert banner on blur
To be consistent with the options we use elsewhere, where we use text / html suffixes together, update the Nunjucks template for the notification banner to accept `titleText` rather than `title`.
Change ‘title’ to ‘titleText’ in notification banner
NOTE: this PR does not update the macro documentation - this will be done separately in #2001

We have decided to keep the aria-labelledby attribute on alert banners too, to make things consistent with the error summary. We were seeing some odd behaviour when testing with NVDA and Voiceover, but this change did not seem to have a negative impact and it also means that when we next revisit the component we're at least working from a place where everything is consistent to start with.
Add a version of an ‘error’ style notification banner to a new full page example based on ‘Upload a Photo’, where the photo upload always fails.
Add aria labelledby to alert notification banners
Co-authored-by: Eoin Shaughnessy <eoin.shaughnessy@digital.cabinet-office.gov.uk>
Add notification banner to a full page example
Update param descriptions for notification banner
@36degrees 36degrees merged commit 742cfe6 into master Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants