Skip to main content
Checks that visible label text is part of accessible name
Rule IDa11y/label-content-name-mismatch
CategoryAccessibility
ScopePer-page
Severityerror
Weight7/10

Solution

For controls with visible labels, the accessible name should contain the visible text. Voice control users say what they see - if the accessible name doesn’t include the visible label, voice commands won’t work. Example: A button showing ‘Search’ should not have aria-label=‘Find products’.

Enable / Disable

Disable this rule

squirrel.toml
[rules]
disable = ["a11y/label-content-name-mismatch"]

Disable all Accessibility rules

squirrel.toml
[rules]
disable = ["a11y/*"]

Enable only this rule

squirrel.toml
[rules]
enable = ["a11y/label-content-name-mismatch"]
disable = ["*"]