Skip to content
← Back to rules

jsx-a11y/aria-props 正确性

🛠️ An auto-fix is available for this rule for some violations.

它的作用

强制要求元素不使用无效的 ARIA 属性。

为什么这是个问题?

使用无效的 ARIA 属性可能会误导屏幕阅读器和其他辅助技术。 这可能导致网站的无障碍功能失效,使残障用户难以有效地使用该网站。

此规则包含对一些常见拼写错误的修复。

示例

以下为错误代码示例:

jsx
<input aria-labeledby="address_label" />

以下为正确代码示例:

jsx
<input aria-labelledby="address_label" />

如何使用

要通过配置文件或命令行启用此规则,可以使用:

json
{
  "plugins": ["jsx-a11y"],
  "rules": {
    "jsx-a11y/aria-props": "error"
  }
}
bash
oxlint --deny jsx-a11y/aria-props --jsx-a11y-plugin

参考资料