Skip to content

jsx_a11y/aria-activedescendant-has-tabindex Correctness

This rule is turned on by default.

What it does

Enforce elements with aria-activedescendant are tabbable.

Example

jsx
const Good = (
  <>
    <CustomComponent />
    <CustomComponent aria-activedescendant={someID} />
    <CustomComponent aria-activedescendant={someID} tabIndex={0} />
    <CustomComponent aria-activedescendant={someID} tabIndex={-1} />
    <div />
    <input />
    <div tabIndex={0} />
    <div aria-activedescendant={someID} tabIndex={0} />
    <div aria-activedescendant={someID} tabIndex="0" />
    <div aria-activedescendant={someID} tabIndex={1} />
    <div aria-activedescendant={someID} tabIndex={-1} />
    <div aria-activedescendant={someID} tabIndex="-1" />
    <input aria-activedescendant={someID} />
    <input aria-activedescendant={someID} tabIndex={0} />
    <input aria-activedescendant={someID} tabIndex={-1} />
  </>
);

const Bad = <div aria-activedescendant={someID} />;

How to use

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

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

References

Released under the MIT License.