Files
ai-course/node_modules/eslint-plugin-jsx-a11y/docs/rules/no-redundant-roles.md
KQL ce6aa207e9 fix: 修复图片路径以适配GitHub Pages base path
- 将所有图片路径从绝对路径改为使用 process.env.PUBLIC_URL
- 修复 HomePage.tsx 中所有图片引用
- 修复 CoursePage.tsx 中所有图片引用
- 确保图片在 GitHub Pages 上正确加载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:24:45 +08:00

1.4 KiB

jsx-a11y/no-redundant-roles

💼 This rule is enabled in the following configs: ☑️ recommended, 🔒 strict.

Some HTML elements have native semantics that are implemented by the browser. This includes default/implicit ARIA roles. Setting an ARIA role that matches its default/implicit role is redundant since it is already set by the browser.

Rule options

The default options for this rule allow an implicit role of navigation to be applied to a nav element as is advised by w3. The options are provided as an object keyed by HTML element name; the value is an array of implicit ARIA roles that are allowed on the specified element.

{
  'jsx-a11y/no-redundant-roles': [
    'error',
    {
      nav: ['navigation'],
    },
  ],
}

Succeed

<div />
<button role="presentation" />
<MyComponent role="main" />

Fail

<button role="button" />
<img role="img" src="foo.jpg" />

Accessibility guidelines

General best practice (reference resources)

Resources