diff --git a/core/misc/announce.js b/core/misc/announce.js index 9aafbbc..fc116f0 100644 --- a/core/misc/announce.js +++ b/core/misc/announce.js @@ -27,14 +27,20 @@ */ Drupal.behaviors.drupalAnnounce = { attach: function (context) { - // Create only one aria-live element. - if (!liveElement) { + // Create only one aria-live element. Check for a live element in + // the parent window to address of the case of a page loading + // in the overlay or an iframe. + var el = parent.window.document.getElementById('drupal-live-announce'); + if (el) { + liveElement = el; + } + else { liveElement = document.createElement('div'); liveElement.id = 'drupal-live-announce'; liveElement.className = 'visually-hidden'; liveElement.setAttribute('aria-live', 'polite'); liveElement.setAttribute('aria-busy', 'false'); - document.body.appendChild(liveElement); + parent.window.document.body.appendChild(liveElement); } } }; diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index 01d4654..61a3b6f 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -1277,6 +1277,14 @@ return '
 
'; }, tableDragChangedWarning: function () { + var text = Drupal.t('!changeMarker Changes made in this table will not be saved until the form is submitted.', { + '!changeMarker': Drupal.theme('tableDragChangedMarker') + }); + // Announce the changes. + Drupal.announce(text); + + return '
' + text + '
'; + return ''; } }); diff --git a/core/modules/block/js/block.js b/core/modules/block/js/block.js index c3a4d0d..9cc9878 100644 --- a/core/modules/block/js/block.js +++ b/core/modules/block/js/block.js @@ -132,4 +132,16 @@ } }; +// A custom message for the blocks page specifically. +Drupal.theme.tableDragChangedWarning = function () { + var text = Drupal.t('!changeMarker The changes to these blocks will not be saved until the %button button is clicked.', { + '!changeMarker': Drupal.theme('tableDragChangedMarker'), + '%button': Drupal.t('Save blocks') + }); + // Announce the changes. + Drupal.announce(text); + + return '
' + text + '
'; +}; + })(jQuery, window);