MDL-68167 lib: Do not set aria-expanded if it should not be set

This commit is contained in:
Shamim Rezaie
2020-10-30 16:11:16 +11:00
parent eb238722da
commit ed7485277e
3 changed files with 8 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -2
View File
@@ -343,8 +343,12 @@ function($, log, str, templates, notification, LoadingIcon) {
var inputElement = $(document.getElementById(state.inputId));
var suggestionsElement = $(document.getElementById(state.suggestionsId));
// Announce the list of suggestions was closed, and read the current list of selections.
inputElement.attr('aria-expanded', false).attr('aria-activedescendant', state.selectionId);
if (inputElement.attr('aria-expanded') === "true") {
// Announce the list of suggestions was closed.
inputElement.attr('aria-expanded', false);
}
// Read the current list of selections.
inputElement.attr('aria-activedescendant', state.selectionId);
// Hide the suggestions list (from screen readers too).
suggestionsElement.hide().attr('aria-hidden', true);