Skip to content

refactor(aria): share the none role definition with presentation - #5255

Merged
straker merged 3 commits into
developfrom
chut/5249-none-presentation-synonym
Aug 3, 2026
Merged

refactor(aria): share the none role definition with presentation#5255
straker merged 3 commits into
developfrom
chut/5249-none-presentation-synonym

Conversation

@chutchins25

Copy link
Copy Markdown
Contributor

Models presentation as a synonym of none and removes the hardcoded ['none', 'presentation'] membership checks, per @WilcoFiers on #4656.

Stacked PR — targets chut/4656-role-image-synonym (#4656), which introduced the synonym mechanism this builds on. GitHub will auto-retarget to develop once #4656 merges.

What & why

Uses the synonym mechanism from #4656:

  • presentation role gets synonym: 'none', so getExplicitRole/getRole resolve it to the canonical none.
  • The implicit presentation role (empty-alt <img>) is also normalized to none at the data level (implicit-html-roles.js), so getRole never returns 'presentation' from either the explicit or implicit path.

With role resolution always yielding none, the scattered ['none', 'presentation'].includes(role) checks that read from getRole/getExplicitRole collapse to a single role === 'none' — 18 sites simplified.

Intentionally left with both terms

  • fallbackrole-evaluate.js — reads raw role attribute tokens (tokenList), so it needs the literal presentation and none tokens.
  • presentation-role-conflict.json (CSS selector) and html-elms.js allowedRoles arrays — raw/selector paths.
  • lookup-table.js evaluateRoleForElement — has no call sites, so its input couldn't be verified as normalized.

Behavior note

getRole/getExplicitRole now return 'none' where they previously could return 'presentation' (they're synonyms — none is the canonical term). End-to-end rule results are unchanged (all integration + virtual-rule suites pass without expectation changes); only internal commons role-resolution output and the corresponding unit-test expectations changed.

Tests

  • implicit-role, get-role (13 inheritance cases), presentational-role, aria-allowed-role — result expectations updated presentationnone.
  • Full commons / checks / integration / virtual-rule suites green; no generated-file drift.

Closes #5249

@chutchins25
chutchins25 force-pushed the chut/4656-role-image-synonym branch from 5e48786 to eee05ae Compare July 29, 2026 15:12
@chutchins25
chutchins25 force-pushed the chut/5249-none-presentation-synonym branch 2 times, most recently from 222cd8d to 8f8e17a Compare July 29, 2026 16:23
@chutchins25
chutchins25 force-pushed the chut/4656-role-image-synonym branch from 54be348 to eee05ae Compare July 29, 2026 16:42
@chutchins25
chutchins25 force-pushed the chut/5249-none-presentation-synonym branch from 8f8e17a to 222cd8d Compare July 29, 2026 16:42

@straker straker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion in #5248 (review), the only thing this pr should do is extract the role defintion in aria-roles for none into it's own object and spread it to the none and presentation roles so they remain linked.

@chutchins25
chutchins25 force-pushed the chut/4656-role-image-synonym branch from eee05ae to 229e59f Compare July 29, 2026 17:00
Extract the none role definition into a shared object and spread it into
both the none and presentation roles so they stay in sync. Per the
discussion on #5248, this drops the earlier synonym approach and keeps
the existing [none, presentation] role checks as-is.

Closes #5249
@chutchins25
chutchins25 force-pushed the chut/5249-none-presentation-synonym branch from 222cd8d to b13d753 Compare July 29, 2026 17:10
@chutchins25
chutchins25 changed the base branch from chut/4656-role-image-synonym to develop July 29, 2026 17:10
@chutchins25 chutchins25 changed the title refactor(aria): model presentation as a synonym of none refactor(aria): share the none role definition with presentation Jul 29, 2026
@chutchins25
chutchins25 marked this pull request as ready for review July 29, 2026 17:43
@chutchins25
chutchins25 requested a review from a team as a code owner July 29, 2026 17:43
Copilot AI review requested due to automatic review settings July 29, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the ARIA standards role definitions to centralize the shared spec for the none and presentation roles, aiming to keep the two role entries consistent as the codebase moves toward treating them equivalently.

Changes:

  • Introduces a shared noneRole object for common role metadata.
  • Replaces duplicated inline definitions for none and presentation with spreads of noneRole.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/standards/aria-roles.js
@chutchins25
chutchins25 marked this pull request as draft July 29, 2026 20:18
…sentation-synonym

# Conflicts:
#	lib/standards/aria-roles.js
@straker
straker marked this pull request as ready for review August 3, 2026 22:08
@straker
straker merged commit 302329e into develop Aug 3, 2026
23 checks passed
@straker
straker deleted the chut/5249-none-presentation-synonym branch August 3, 2026 22:09
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

Successfully merging this pull request may close these issues.

Model presentation/none as synonyms and remove hardcoded [none, presentation] checks

3 participants