Skip to content

Commit

Permalink
Prevent aria-describedby attribute being added to hidden inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen committed Nov 2, 2022
1 parent a96926d commit 5a90162
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class InputCharacterCounter {
this.$target = $(this.$input.data("remaining-characters"));
this.minCharacters = parseInt(this.$input.attr("minlength"), 10);
this.maxCharacters = parseInt(this.$input.attr("maxlength"), 10);
this.describeByCounter = typeof this.$input.attr("aria-describedby") === "undefined";
this.describeByCounter = this.$input.attr("type") !== "hidden" && typeof this.$input.attr("aria-describedby") === "undefined";

// Define the closest length for the input "gaps" defined by the threshold.
if (this.maxCharacters > 10) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class InputCharacterCounter {
this.$target = $(this.$input.data("remaining-characters"));
this.minCharacters = parseInt(this.$input.attr("minlength"), 10);
this.maxCharacters = parseInt(this.$input.attr("maxlength"), 10);
this.describeByCounter = typeof this.$input.attr("aria-describedby") === "undefined";
this.describeByCounter = this.$input.attr("type") !== "hidden" && typeof this.$input.attr("aria-describedby") === "undefined";

// Define the closest length for the input "gaps" defined by the threshold.
if (this.maxCharacters > 10) {
Expand Down

0 comments on commit 5a90162

Please sign in to comment.