Skip to content
← Back to rules

jsx-a11y/aria-props Correctness

🛠️ 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" />

如何使用

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["jsx-a11y"],
  "rules": {
    "jsx-a11y/aria-props": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jsx-a11y"],
  rules: {
    "jsx-a11y/aria-props": "error",
  },
});
bash
oxlint --deny jsx-a11y/aria-props --jsx-a11y-plugin

版本

此规则是在 v0.0.22 中添加的。

参考资料