Repository navigation
fix(rules): aria-dialog-name identifies id-less dialogs by class and start tag #462 - #475
Merged
Merged
Conversation
nc9
marked this pull request as ready for review
October 6, 2026 00:18
…start tag #462 An unnamed dialog without an id was reported as a bare "dialog", so a page with several id-less drawers gave no way to tell which lacked a name. Items now use the a11y rules' tag#id / tag.class handle (dialog.newsletter-popup, div[role="dialog"].modal) with the start tag as a snippet, and keep dialog#id and role#id when there is an id. Dialogs sharing a handle get an ordinal counted over every dialog of the kind, so naming one does not renumber the rest, and an ordinal never repeats an id already issued. Closes #462 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/aria-dialog-name-462
branch
from
October 6, 2026 00:18
e11eff2 to
254ea8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #462
What was wrong
a11y/aria-dialog-namelisted an unnamed dialog asdialog#<id>, or as a baredialog(or role name) when it had no id. On a page with several id-less dialogs, such as a Shopify theme's cart, menu and newsletter drawers, the report could not say which one lacked a name. The duplicate ids also collapsed into one finding wherever items are keyed by id.The fix
tag#id/tag.classstyle the other a11y rules already use (button-name,tabindex,empty-heading):dialog#cartfor a native dialog,dialog#settings/alertdialog#confirmfor an ARIA one;dialog.newsletter-popup, ordiv[role="dialog"].modalfor an ARIA dialog.snippet, via the sharedfieldSnippethelper thata11y/autocomplete-tokensalready uses (attributes only, capped at 200 characters, neverouterHTML).dialog.drawer (2).dialog.drawer (2)intodialog.drawer.Identity across rescans
The item id is the finding's locator in the cloud merge (
merge-coreflattenChecks). It depends only on the markup, so the same page gives the same ids on every scan, and fixing one dialog leaves the others' ids alone (tested).One-time effect, filed as #474: on a page that still has an unnamed dialog, the legacy bare
dialogfinding stays open as a carried finding beside the new id. That is becausemerge-corecarries unmatched prior items while the page is still in the check's failing set. It resolves when the page's dialogs are all named. Any item-id change on a still-failing page does this, which is why it is filed separately.Evidence (CLI from source,
--http -f json --refresh, the issue's repro page)Before:
{"name": "dialog-name", "status": "warn", "message": "1 native <dialog>(s) without accessible names", "items": [{"id": "dialog"}]}After:
{"name": "dialog-name", "status": "warn", "message": "1 native <dialog>(s) without accessible names", "items": [{"id": "dialog.newsletter-popup", "snippet": "<dialog class=\"newsletter-popup\">"}]}Tests
packages/rules/tests/aria-dialog-name.test.ts(13 tests) covers:dialog#id, class order and the three-class cap, and a baredialog;role#id, and the ten-item cap.8 of the 13 fail on
main.aria-dialog-name,template-verdict-page-independence,noscript-content.tsgo --noEmitclean inpackages/rules(and the test file). oxlint clean.[email protected] check --strictpasses.Changelog suggestion
a11y/aria-dialog-nameidentifies an unnamed dialog with no id by its classes and start tag (dialog.newsletter-popup) instead of a baredialog. Thanks @deniskern (a11y/aria-dialog-name: id-less dialogs are reported as bare "dialog", no way to locate them #462)