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:01:38 +11:00
parent c682aa5f97
commit e2ee6025fe
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
@@ -336,8 +336,12 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
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).
Aria.hide(suggestionsElement.get());