docs(a11y): action menu a11y migration docs#6162
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
cdransf
left a comment
There was a problem hiding this comment.
Looks good! Added a few suggestions ✨
|
|
||
| Treat **application command menus** (action menu) and **site navigation** patterns as separate 2nd-gen components or documented compositions. Their keyboard contracts, roles, and user expectations differ; conflating them encourages incorrect `role="menu"` on link lists and confusing screen reader interaction modes. | ||
|
|
||
| ## Also read |
There was a problem hiding this comment.
| ## Also read | |
| ### Also read |
|
|
||
| - [Action menu migration roadmap](./rendering-and-styling-migration-analysis.md) — 2nd-gen DOM, CSS, and API migration (placeholder until expanded). | ||
|
|
||
| ## What it is not |
There was a problem hiding this comment.
| ## What it is not | |
| ### What it is not |
| - **Action menu (commands):** **`swc-action-menu`** plus **`swc-menu`** with **`menu`** / **`menuitem`** family. | ||
| - **Navigation (links, site structure):** prefer disclosure navigation or menubar navigation examples as separate components or documented patterns; do not reuse **`swc-action-menu`** semantics for pure link navigation without a deliberate APG match. | ||
|
|
||
| ## Shadow DOM and cross-root accessibility |
There was a problem hiding this comment.
| ## Shadow DOM and cross-root accessibility | |
| ### Shadow DOM and cross-root accessibility |
| - Prefer focusable menu items with roving **`tabindex`** inside the menu root over `aria-activedescendant` pointing across shadow roots. | ||
| - Ensure visible focus rings and high contrast behavior for focused **`menuitem`** rows. | ||
|
|
||
| ## Tree expectations |
There was a problem hiding this comment.
| ## Tree expectations | |
| ### Tree expectations |
| - **`swc-menu`** root has **`role="menu"`** and an accessible name (from label or **`aria-labelledby`**) when needed. | ||
| - Items expose **`menuitem`** (or checkbox or radio variants) and correct **`aria-checked`** / **`aria-disabled`** as applicable. | ||
|
|
||
| ## Keyboard |
There was a problem hiding this comment.
| ## Keyboard | |
| ### Keyboard |
|
|
||
| When **`swc-menu`** supports **submenus**, also align submenu open/close and cross-level movement with the [menubar pattern keyboard table](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) (submenu section) or an equivalent documented mapping. | ||
|
|
||
| ## Assistive technology and Escape |
There was a problem hiding this comment.
| ## Assistive technology and Escape | |
| ### Assistive technology and Escape |
| - **Not** primary site navigation by default: for collections of links that navigate pages, the APG [disclosure navigation menu example](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/) explicitly avoids **`role="menu"`** because typical site navigation does not implement the full menu keyboard contract, and **`menu`** triggers interaction modes screen readers reserve for application widgets. | ||
| - **Not** `aria-activedescendant` for focus in 2nd-gen: cross-root ARIA does not solve active descendant across shadow boundaries reliably, and `aria-activedescendant` has known limitations on iOS VoiceOver. Action menu should use the proposed **`FocusgroupNavigationController`** (and related focus group work) as in [spectrum-web-components#6129](https://github.com/adobe/spectrum-web-components/pull/6129), not `aria-activedescendant`, for roving tabindex and arrow navigation inside the menu. | ||
|
|
||
| ## Pattern in the WAI-ARIA APG |
There was a problem hiding this comment.
Should this be updated? (And should it be under ## ARIA and WCAG context? Going off of the skill at .ai/skills/accessibility-migration-analysis/SKILL.md). ✨
| ## Pattern in the WAI-ARIA APG | |
| ### Pattern in the APG |
|
|
||
| **Takeaway:** use **`menu`** and **`menuitem`** family roles when behavior matches the menu button or menubar patterns. Use disclosure plus native links (or tabs or other patterns) when the primary job is in-page or multi-page navigation without application menu semantics. | ||
|
|
||
| ## Guidelines |
There was a problem hiding this comment.
| ## Guidelines | |
| ### Guidelines that apply |
|
|
||
| <!-- Document content (editable) --> | ||
|
|
||
| ## Overview |
There was a problem hiding this comment.
From the skill:
Separate major sections with a horizontal rule (---) where existing docs use it (after Overview, after ARIA and WCAG context, after Related 1st-gen accessibility (Jira) before Recommendations, after Recommendations block before Testing).
Do we need those? ✨
rubencarvalho
left a comment
There was a problem hiding this comment.
Left a few comments given the new menu direction 😄
|
|
||
| ## Overview | ||
|
|
||
| **`<swc-action-menu>`** (2nd-gen) is the Spectrum surface for a **menu button** that opens commands or choices in an overlay. On **smaller viewports** the menu should open in a **tray** by default for touch targets, readability, and escape from cramped layouts; on larger viewports it typically uses a **popover** unless the author **forces** popover (or tray) via API. It composes a trigger (typically a button) with `aria-haspopup="menu"`, `aria-expanded`, and `aria-controls` (or equivalent wiring) and a **`swc-menu`** that exposes **`role="menu"`** to assistive technologies regardless of tray vs popover presentation. The trigger and menu must share one DOM or shadow root because cross-root ARIA is not supported in browsers today. |
There was a problem hiding this comment.
We found that we won’t have a concept of Tray for now, so this may need some adjustments.
|
|
||
| ### Composition and labelling | ||
|
|
||
| - Always compose **`swc-menu`** inside a parent that provides open/close, focus return to the trigger, and `aria-labelledby` or `aria-label` for the menu where needed. |
There was a problem hiding this comment.
We will build menu as the current 1st gen action menu, meaning the trigger comes "included", so this may need some adjustments
| - **Trigger and menu must share one root:** the trigger (button) and the **`swc-menu`** surface must live in the same tree root (for example both inside the **`swc-action-menu`** shadow root or the same light-DOM subtree owned by that host). **Cross-root ARIA** — ID references such as **`aria-controls`**, **`aria-labelledby`**, and **`aria-activedescendant`** across separate shadow roots — is not supported in browsers today, so splitting the trigger and menu across unrelated custom element boundaries breaks those relationships. | ||
| - Trigger should mirror APG menu button attributes (`aria-haspopup`, `aria-expanded`, `aria-controls` when appropriate). | ||
|
|
||
| ### Viewport and presentation (tray vs popover) |
There was a problem hiding this comment.
2nd-gen mobile drill-down is still WIP on the design side. There are currently no decisions on the future of tray. We will keep these out of scope until we know more.
| <swc-action-menu label="Actions"> | ||
| <swc-menu id="actions-menu"> | ||
| <swc-menu-item>Duplicate</swc-menu-item> | ||
| <swc-menu-item>Rename</swc-menu-item> | ||
| <swc-menu-separator></swc-menu-separator> | ||
| <swc-menu-item>Delete</swc-menu-item> | ||
| </swc-menu> | ||
| </swc-action-menu> |
There was a problem hiding this comment.
I believe we may collapse this further, e.g.:
| <swc-action-menu label="Actions"> | |
| <swc-menu id="actions-menu"> | |
| <swc-menu-item>Duplicate</swc-menu-item> | |
| <swc-menu-item>Rename</swc-menu-item> | |
| <swc-menu-separator></swc-menu-separator> | |
| <swc-menu-item>Delete</swc-menu-item> | |
| </swc-menu> | |
| </swc-action-menu> | |
| <swc-menu label="Actions"> | |
| <swc-menu-item>Duplicate</swc-menu-item> | |
| <swc-menu-item>Rename</swc-menu-item> | |
| <swc-menu-separator></swc-menu-separator> | |
| <swc-menu-item>Delete</swc-menu-item> | |
| </swc-menu> |
Description
In spectrum-web-components/CONTRIBUTOR-DOCS/03_project-planning/03_components/action-menu/accessibility-migration-analysis.md:
Motivation and context
The ticket requests accessibility recommendations for action-menu as part of its migration from 1st-gen to 2nd-gen. The recommendations should produce a comprehensive set of accessibility requirements that the engineering team will use as the specification for the 2nd-gen implementation.
The 2nd-gen migration is an opportunity to address known accessibility gaps, align with the latest WAI-ARIA Authoring Practices, and ensure the component meets WCAG 2.2 AA compliance.
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Review the Action menu accessibility migration analysis