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

target-size: false positive for small targets in focusable tabpanels #4701

Closed
1 task done
dbjorge opened this issue Feb 6, 2025 · 1 comment · Fixed by #4702
Closed
1 task done

target-size: false positive for small targets in focusable tabpanels #4701

dbjorge opened this issue Feb 6, 2025 · 1 comment · Fixed by #4702
Labels
fix Bug fixes rules Issue or false result from an axe-core rule support target-size

Comments

@dbjorge
Copy link
Contributor

dbjorge commented Feb 6, 2025

Product

axe-core

Product Version

4.10.2

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

A common pattern with tab panels is for the panel to be focusable, but not clickable. The tab panel in this case isn't a "target" for the purposes of 2.5.5/2.5.8 because it doesn't respond to pointer events. However, because axe-core currently considers tabpanel to be a widget role type, the target-offset check considers a focusable tabpanel to be a target.

I think the fix for this is likely to update aria-roles.js to treat tabpanel as a structure role rather than a widget role. The ARIA spec is ambiguous about which is correct (wai-aria-1.2 §5.3.2 Widget Roles says that tabpanel is a widget, but the tabpanel role section says it rolls up to section/structure), but I think in practice structure is more accurate and would fix the false positive here.

Expectation

When an interactive target is contained in a focusable tabpanel, it shouldn't cause target-offset violations.

Actual

Axe reports a violation.

How to Reproduce

<div role="tabpanel" tabindex="0">
  <h2>My cool tabpanel content</h2>
  <input id="target" type="checkbox">A checkbox inside the focusable tabpanel</input>
</div>
await axe.run('#target', { runOnly: 'target-size' })

Additional context

I think we meant to address this in #4371 / #4421, but missed it due to the ambiguity in the ARIA spec mentioned above.

@dbjorge
Copy link
Contributor Author

dbjorge commented Feb 10, 2025

Confirmed with @WilcoFiers that he's on board with making this change to treat tabpanel as structure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes rules Issue or false result from an axe-core rule support target-size
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant