Skip to content
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

isFocusable is too strict on tabindex #4632

Closed
WilcoFiers opened this issue Nov 6, 2024 · 2 comments · Fixed by #4637
Closed

isFocusable is too strict on tabindex #4632

WilcoFiers opened this issue Nov 6, 2024 · 2 comments · Fixed by #4637
Labels
core Issues in the core code (lib/core) fix Bug fixes good first issue For first-time contributors

Comments

@WilcoFiers
Copy link
Contributor

WilcoFiers commented Nov 6, 2024

The way axe-core checks whether tabindex is valid is by calling parseInt(). That's different from how HTMLhttps://html.spec.whatwg.org/#rules-for-parsing-integers says to do it. Basically, axe should use this to match, and then parseInt the captured group: /^\s*([-+]?\d+)/

The issue is here: lib/commons/dom/is-focusable.js
The tests for it need to be here: test/commons/dom/is-focusable.js

@WilcoFiers WilcoFiers added core Issues in the core code (lib/core) fix Bug fixes good first issue For first-time contributors labels Nov 6, 2024
@ahmedhalac
Copy link
Contributor

Hi @WilcoFiers. Can I work on this?

@WilcoFiers
Copy link
Contributor Author

@ahmedhalac, yeah that would be great!

ahmedhalac added a commit to ahmedhalac/axe-core that referenced this issue Nov 11, 2024
Ensures tabindex is correctly parsed as an integer using regex instead of parseInt to comply with HTML standards.

Related to dequelabs#4632
ahmedhalac added a commit to ahmedhalac/axe-core that referenced this issue Nov 13, 2024
Add parseTabindex method in lib/core/utils and reused it in multiple places across the codebase

Related to dequelabs#4632
ahmedhalac added a commit to ahmedhalac/axe-core that referenced this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes good first issue For first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants