JS-1464 Fix S6819 false positives on ARIA composite widget patterns#6645
Conversation
Tests cover the scenario where ARIA composite widget roles (listbox/option and inner roles like button) are incorrectly flagged when used on generic HTML elements within composite widget structures. The tests verify that: - div-based listbox/option composite widgets are not flagged - ul/li-based listbox/option widgets are not flagged (no div/span restriction) - role="button" inside a grid composite widget is not flagged - orphan option and standalone listbox without descendants remain flagged An upstream sentinel block verifies the underlying jsx-a11y rule still raises on these patterns, ensuring the decorator suppression remains valid. Relates to JS-1464
The decorator's isCustomTableWidget function only handled table/grid container roles restricted to div/span elements, missing listbox/option composite widgets and inner roles (like button) nested inside composite containers. The fix renames isCustomTableWidget to isCustomCompositeWidget and: - Adds listbox to COMPOSITE_CONTAINER_ROLES (alongside table, grid) - Adds option to COMPOSITE_CHILD_ROLES (alongside row, gridcell, etc.) - Adds COMPOSITE_INNER_ROLES (button, presentation, none) that are suppressed when nested inside any composite container - Removes the div/span element-name restriction from all traversals, allowing ul/li and other HTML elements to form valid composite widgets The rspec is updated with a compliant listbox/option example clarifying that ARIA roles are appropriate when the semantic HTML alternative requires an incompatible parent context. Relates to JS-1464
Ruling Report✅ No changes to ruling expected issues in this PR |
|
SummaryThis PR fixes false positives in S6819 by extending ARIA composite widget pattern detection beyond tables/grids to include listbox/option patterns and inner roles like Key changes:
The fix targets a real gap: What reviewers should knowReading order:
Non-obvious points:
|
SummaryThis PR expands S6819's false-positive suppression from table-specific patterns (div/span with table/grid roles) to a broader range of ARIA composite widget patterns. Key changes: (1) adds What reviewers should knowStart here: The core logic is in
|
SummaryExtends S6819 composite widget detection to handle The key change is removing the element-name restriction that previously limited detection to Adds a clever upstream sentinel test that verifies the upstream What reviewers should knowStart here: Review the three role sets ( Key decisions to verify:
Testing approach: Two test blocks:
No breaking changes: Only suppresses additional false positives; doesn't change what's actually reported as violations.
|




Fix false positives in S6819 (aria-roles-required-for-custom-composite-widgets) where valid ARIA composite widget patterns were incorrectly flagged.
What changed
The decorator's
isCustomTableWidgetfunction was too narrow — it only handled table/grid container roles on div/span elements, missing other valid composite widget patterns. It has been renamed toisCustomCompositeWidgetand extended:listboxtoCOMPOSITE_CONTAINER_ROLES(alongsidetable,grid)optiontoCOMPOSITE_CHILD_ROLES(alongsiderow,gridcell, etc.)COMPOSITE_INNER_ROLES(button,presentation,none) that are suppressed when nested inside any composite containerul/liand other HTML elements to form valid composite widgetsWhy
ARIA composite widget patterns using
listbox/optionroles (including onul/lielements) and inner roles likebuttonnested inside composite containers were being incorrectly reported as violations. These are valid uses of ARIA roles when the semantic HTML alternative requires an incompatible parent context.The RSPEC has been updated with a compliant
listbox/optionexample to document this case.Relates to JS-1464
Proposed rspec changes