2021-07-20 12:14:10 +01:00
|
|
|
(function (window) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
This module is intended to be used to show and hide an error banner based on a javascript trigger. You should make
|
|
|
|
|
sure the banner has an appropriate aria-live attribute, and a tabindex of -1 so that screenreaders and keyboard users
|
|
|
|
|
are alerted to the change respectively.
|
|
|
|
|
|
|
|
|
|
This may behave in unexpected ways if you have more than one element with the `banner-dangerous` class on your page.
|
|
|
|
|
*/
|
|
|
|
|
window.GOVUK.ErrorBanner = {
|
2023-08-25 10:40:56 -04:00
|
|
|
hideBanner: () => $('.banner-dangerous').addClass('display-none'),
|
2021-09-13 16:31:58 +01:00
|
|
|
showBanner: () => $('.banner-dangerous')
|
2023-08-25 10:40:56 -04:00
|
|
|
.removeClass('display-none')
|
2021-07-20 12:14:10 +01:00
|
|
|
.trigger('focus'),
|
|
|
|
|
};
|
|
|
|
|
})(window);
|