From: Nicolas Coden Date: Sun, 7 Jan 2018 22:30:05 +0000 (+0100) Subject: fix: fix dropdown aria-labelledby from its anchor id X-Git-Tag: v6.6.0~3^2~320^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bad6edd3;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: fix dropdown aria-labelledby from its anchor id Introduced in https://github.com/zurb/foundation-sites/pull/10360 (https://github.com/zurb/foundation-sites/pull/10360/commits/36521fb40fd438c14925208020128311c0dddeaa) Closes https://github.com/zurb/foundation-sites/issues/10627 --- diff --git a/js/foundation.dropdown.js b/js/foundation.dropdown.js index f1da4c541..71d41c24a 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(); }