From: Nicolas Coden Date: Sat, 16 Jun 2018 07:10:38 +0000 (+0200) Subject: Use pull request #10840 from ncoden/fix/dropdown-anchor-attributes-10627 for v6.5.0 X-Git-Tag: v6.5.0-rc.1^2~167 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7b4208908614ec788d2f95ecaca9891fb16dae7;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Use pull request #10840 from ncoden/fix/dropdown-anchor-attributes-10627 for v6.5.0 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 --- diff --git a/js/foundation.dropdown.js b/js/foundation.dropdown.js index f1da4c541..16b157335 100644 --- a/js/foundation.dropdown.js +++ b/js/foundation.dropdown.js @@ -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]; }