MDL-68167 lib: Do not set aria-expanded if it should not be set
authorShamim Rezaie <shamim@moodle.com>
Thu, 29 Oct 2020 17:59:40 +0000 (04:59 +1100)
committerShamim Rezaie <shamim@moodle.com>
Fri, 30 Oct 2020 05:01:38 +0000 (16:01 +1100)
lib/amd/build/form-autocomplete.min.js
lib/amd/build/form-autocomplete.min.js.map
lib/amd/src/form-autocomplete.js

index 2db663c..d7a7cc1 100644 (file)
Binary files a/lib/amd/build/form-autocomplete.min.js and b/lib/amd/build/form-autocomplete.min.js differ
index bcee522..ec34cfe 100644 (file)
Binary files a/lib/amd/build/form-autocomplete.min.js.map and b/lib/amd/build/form-autocomplete.min.js.map differ
index bde69cd..8788e94 100644 (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());