diff --git a/core/misc/announce.js b/core/misc/announce.js index e0fc2e6..3e579de 100644 --- a/core/misc/announce.js +++ b/core/misc/announce.js @@ -91,21 +91,23 @@ * These messages are then joined and append to the aria-live region as one * text node. * - * @param String text + * @param {String} text * A string to be read by the UA. - * @param String priority + * @param {String} priority * A string to indicate the priority of the message. Can be either * 'polite' or 'assertive'. Polite is the default. * * @see http://www.w3.org/WAI/PF/aria-practices/#liveprops */ Drupal.announce = function (text, priority) { - // Save the text and priority into a closure variable. Multiple simultaneous - // announcements will be concatenated and read in sequence. - announcements.push({ - text: text, - priority: priority - }); - debouncedProcessAnnounce(announcements); + if (typeof text === 'string') { + // Save the text and priority into a closure variable. Multiple simultaneous + // announcements will be concatenated and read in sequence. + announcements.push({ + text: text, + priority: priority + }); + debouncedProcessAnnounce(announcements); + } }; }(Drupal, Drupal.debounce)); diff --git a/core/misc/message.js b/core/misc/message.js index 11c4acd..44fb4f2 100644 --- a/core/misc/message.js +++ b/core/misc/message.js @@ -54,13 +54,15 @@ * Default to 'status' */ Drupal.message = function (message, type) { - // Save the text and priority into a closure variable. Multiple simultaneous - // announcements will be concatenated and read in sequence. - messages.push({ - text: message, - type: type || 'status' - }); - debouncedProcessMessages(messages); + if (typeof message === 'string') { + // Save the text and priority into a closure variable. Multiple simultaneous + // announcements will be concatenated and read in sequence. + messages.push({ + text: message, + type: type || 'status' + }); + debouncedProcessMessages(messages); + } }; /**