2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function (Drupal, debounce) {
9 var liveElement = void 0;
10 var announcements = [];
12 Drupal.behaviors.drupalAnnounce = {
13 attach: function attach(context) {
15 liveElement = document.createElement('div');
16 liveElement.id = 'drupal-live-announce';
17 liveElement.className = 'visually-hidden';
18 liveElement.setAttribute('aria-live', 'polite');
19 liveElement.setAttribute('aria-busy', 'false');
20 document.body.appendChild(liveElement);
27 var priority = 'polite';
28 var announcement = void 0;
30 var il = announcements.length;
31 for (var i = 0; i < il; i++) {
32 announcement = announcements.pop();
33 text.unshift(announcement.text);
35 if (announcement.priority === 'assertive') {
36 priority = 'assertive';
41 liveElement.innerHTML = '';
43 liveElement.setAttribute('aria-busy', 'true');
45 liveElement.setAttribute('aria-live', priority);
47 liveElement.innerHTML = text.join('\n');
49 liveElement.setAttribute('aria-busy', 'false');
53 Drupal.announce = function (text, priority) {
59 return debounce(announce, 200)();
61 })(Drupal, Drupal.debounce);