Skip to content

Commit

Permalink
Update input-components-require-accessible-name.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
otkHsiao authored Oct 21, 2024
1 parent 92b6946 commit acebaf5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rules/input-components-require-accessible-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
import { elementType } from "jsx-ast-utils";
import { isInsideLabelTag, hasAssociatedLabelViaHtmlFor, hasAssociatedLabelViaAriaLabelledBy } from "../util/labelUtils";
import { isInsideLabelTag, hasAssociatedLabelViaHtmlFor, hasAssociatedLabelViaAriaLabelledBy, hasAriaLabel } from "../util/labelUtils";
import { hasFieldParent } from "../util/hasFieldParent";
import { applicableComponents } from "../applicableComponents/inputBasedComponents";
import { JSXOpeningElement } from "estree-jsx";
Expand Down Expand Up @@ -41,8 +41,9 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
return;
}

// wrapped in Label tag, labelled with htmlFor, labelled with aria-labelledby
// wrapped in Label tag, labelled with htmlFor, labelled with aria-labelledby, labelled with aria-label
if (
hasAriaLabel(node) ||
hasFieldParent(context) ||
isInsideLabelTag(context) ||
hasAssociatedLabelViaHtmlFor(node, context) ||
Expand Down

0 comments on commit acebaf5

Please sign in to comment.