diff --git a/js/foundation.dropdown.js b/js/foundation.dropdown.js index f1da4c5411..16b157335c 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]; }