From 8bad6edd36f878079367d8d386ce658a4d0d4244 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Sun, 7 Jan 2018 23:30:05 +0100 Subject: [PATCH] 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 --- js/foundation.dropdown.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(); } -- 2.47.2