Skip to content

no-redundant-roles does not detect nullish attributes #1321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ouuan opened this issue Apr 30, 2025 · 0 comments
Open

no-redundant-roles does not detect nullish attributes #1321

ouuan opened this issue Apr 30, 2025 · 0 comments

Comments

@ouuan
Copy link

ouuan commented Apr 30, 2025

For example, I have an <a> tag that is sometimes disabled:

<a
  :href="disabled ? undefined : 'https://example.com'"
  :aria-disabled="disabled"
  role="link"
>
  maybe disabled
</a>

The w3c specification requires a role="link" when it the link is disabled: https://www.w3.org/TR/html-aria/#example-communicate-a-disabled-link-with-aria

But now this plugin does not know that the href is sometimes not set and reports an error for no-redundant-roles.

I'm not familiar with ESLint plugin development, but I'm wondering if this can be fixed by using type information and checking whether the attribute type can be nullish. Alternatively, maybe there can be an option to treat all v-bind attributes as possibly not satisfying the aria constraint, which does not rely on typing information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant