Skip to content

ui-react: Attach and Share popovers claim role=menu without the menu keyboard contract #2578

Open

Description

@schlessera

Context

Part of #2576.

Two hand-rolled dropdowns announce themselves as ARIA menus but implement none of the menu keyboard contract. Focus does not move into them, and arrow keys, Home and End do nothing:

  • Desktop Attach: (ComposerView, packages/ui-react/src/components/chat/composer-view.tsx:200-204) renders <div role="menu" aria-label="Attach">. Its children are ListRows (composer-view.tsx:133-141), which render role="button", not menuitem. The "Paste" row has no handler and so no role. The kit trigger declares aria-haspopup="menu" (IconButton in packages/ui-kit/src/chrome/Composer.tsx:305), and on a phone that same trigger opens a modal sheet, not a menu.
  • Share: (ShareMenu, packages/ui-react/src/components/share/share-menu.tsx:122-142) renders role="menu" with role="menuitem" buttons behind an IconButton haspopup="menu". The diagram share trigger repeats the claim (MermaidBlock, packages/ui-react/src/components/chat/mermaid-block.tsx:108).

composer.tsx:338 also uses [role="menu"][aria-label="Attach"] as its outside-click selector.

Guide ui-atoms/viewport-aware-dropdowns: "Do not apply role="menu" or role="menuitem" unless you fully implement the corresponding keyboard navigation contract … do not add aria-haspopup to the trigger — its value … is a promise that the target exposes a matching role".

Scope

  • Make the desktop Attach popover and ShareMenu plain groups of buttons. Remove role="menu" and role="menuitem". Keep an accessible name on the container (role="group" + aria-label). Keep aria-expanded and add aria-controls on the triggers.
  • Remove aria-haspopup="menu" from the Share trigger, the diagram share trigger and the kit Composer's Attach trigger (Composer.tsx:305). The kit cannot tell whether the consumer opens a popover or a sheet, so the Attach trigger carries no aria-haspopup. Do not add a Composer prop for it.
  • Replace the role-based selector at composer.tsx:338 with a data- hook.
  • Update the tests and stories that assert the old roles: packages/ui-react/tests/render/render-smoke.test.tsx:5792, packages/ui-kit/stories/chrome/Composer.stories.tsx:405, packages/ui-react/tests/browser/diagrams-renderer.layout.tsx:66, packages/ui-react/tests/browser/settings-buttons.cases.tsx:136.

Out of scope

Acceptance criteria

  • grep -rn 'role="menu"\|menuitem\|haspopup="menu"' packages/ui-react/src packages/ui-kit/src matches only session-list.tsx and the kit primitives' prop type unions.
  • The desktop Attach and Share popovers expose a named group of buttons. The Share triggers expose aria-expanded and aria-controls, and no trigger claims aria-haspopup="menu".
  • Tab order, Escape, outside-click dismissal and every option's action behave as before in a real browser at 320px and ≥900px.
  • A browser accessibility-tree assertion reads the new roles and fails on the current tree. Record the failing-first run in the PR.
  • Visual baselines unchanged.

Verification

bun run test packages/ui-react/tests/render/render-smoke.test.tsx
bun run test packages/ui-kit packages/ui-react
node scripts/visual.mjs --project=ui-react-layout --filter=diagrams-renderer
node scripts/visual.mjs --project=storybook --filter=Composer.stories
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

No prop or export changes. Only rendered ARIA attributes change.

Activity

  1. added
    type: fix
    area: ui-react
    area: ui-kit
    priority: p2
    agent-ready
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-kitarea: ui-reactpriority: p2type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions