docbrown/app/javascript/packs/admin/flashMessages.js
Suzanne Aitchison 4d07a1ef7b
Tweaks to the admin flash messages flow (#16582)
* Focus flash message button on load

* update specs

* Update app/javascript/packs/admin/flashMessages.js

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* Update app/javascript/packs/admin/flashMessages.js

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2022-02-16 10:07:21 +00:00

6 lines
387 B
JavaScript

const [ firstFlashDismissBtn ] =
document.getElementsByClassName('js-flash-close-btn');
// This allows screen reader users to become aware of the message (as well as bringing focus to the top of the main content).
// (we don't use aria-live or role="alert" on the message text as these are not reliably announced for content that exists from page load)
firstFlashDismissBtn?.focus();