Skip to content

Commit

Permalink
Use pull request foundation#10840 from ncoden/fix/dropdown-anchor-att…
Browse files Browse the repository at this point in the history
…ributes-10627 for v6.5.0

8bad6ed fix: fix dropdown aria-labelledby from its anchor id
401618a fix: fix dropdown default alignement based on float class

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
  • Loading branch information
ncoden committed Jun 16, 2018
1 parent f1a09cc commit e7b4208
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/foundation.dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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];
}
Expand Down

0 comments on commit e7b4208

Please sign in to comment.