]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Use pull request #10840 from ncoden/fix/dropdown-anchor-attributes-10627 for v6.5.0
authorNicolas Coden <nicolas@ncoden.fr>
Sat, 16 Jun 2018 07:10:38 +0000 (09:10 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Sat, 16 Jun 2018 07:10:38 +0000 (09:10 +0200)
8bad6edd3 fix: fix dropdown aria-labelledby from its anchor id
401618a58 fix: fix dropdown default alignement based on float class

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
js/foundation.dropdown.js

index f1da4c5411199121b7ce76f21124ca55172e1560..16b157335c3b896bdbda934a59417121f1d92a03 100644 (file)
@@ -66,12 +66,18 @@ class Dropdown extends Positionable {
       this.$parent = null;
     }
 
+    // Do not change the `labelledby` if it is defined
+    var labelledby = this.$element.attr('aria-labelledby')
+      || this.$currentAnchor.attr('id')
+      || GetYoDigits(6, 'dd-anchor');
+
     this.$element.attr({
       'aria-hidden': 'true',
       'data-yeti-box': $id,
       'data-resize': $id,
-      'aria-labelledby': this.$currentAnchor.id || GetYoDigits(6, 'dd-anchor')
+      'aria-labelledby': labelledby
     });
+
     super._init();
     this._events();
   }
@@ -88,7 +94,7 @@ class Dropdown extends Positionable {
 
   _getDefaultAlignment() {
     // handle legacy float approach
-    var horizontalPosition = /float-(\S+)/.exec(this.$currentAnchor.className);
+    var horizontalPosition = /float-(\S+)/.exec(this.$currentAnchor.attr('class'));
     if(horizontalPosition) {
       return horizontalPosition[1];
     }