Skip to content

Commit

Permalink
Use pull request foundation#10936 from DanielRuf/patch/abide-stack-re…
Browse files Browse the repository at this point in the history
…vert-end for v6.5.0

1840a11 Revert "fix: fix side-effect of jQuery .filter() in Abide.addA11yAttributes", fixes foundation#10935

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
  • Loading branch information
DanielRuf authored and ncoden committed Jun 16, 2018
1 parent 3c2e903 commit 803d04e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/foundation.abide.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ class Abide extends Plugin {
*/
addA11yAttributes($el) {
let $errors = this.findFormError($el);
let $labels = $errors.filter('label').end();
let $error = $errors.first().end();
let $labels = $errors.filter('label');
let $error = $errors.first();
if (!$errors.length) return;

// Set [aria-describedby] on the input toward the first form error if it is not set
Expand All @@ -229,7 +229,7 @@ class Abide extends Plugin {
$el.attr('aria-describedby', errorId);
}

if ($labels.filter('[for]').end().length < $labels.length) {
if ($labels.filter('[for]').length < $labels.length) {
// Get the input ID or create one
let elemId = $el.attr('id');
if (typeof elemId === 'undefined') {
Expand All @@ -242,7 +242,7 @@ class Abide extends Plugin {
const $label = $(label);
if (typeof $label.attr('for') === 'undefined')
$label.attr('for', elemId);
}).end();
});
}

// For each error targeting $el, set [role=alert] if it is not set.
Expand Down

0 comments on commit 803d04e

Please sign in to comment.