Skip to content

@remotion/studio: give the icon-only menu trigger a discernible name - #12960

Merged
JonnyBurger merged 2 commits into
remotion-dev:mainfrom
gongfpp:fix/studio-menu-aria-label
Nov 5, 2026
Merged

JonnyBurger merged 2 commits into
remotion-dev:mainfrom
gongfpp:fix/studio-menu-aria-label

Conversation

@gongfpp

@gongfpp gongfpp commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #12947.

Problem

The top-left Studio menu trigger is icon-only (the Remotion mark), so the button had no accessible name and Accessibility Insights reported a button-name failure (WCAG 4.1.2) for .__remotion-studio-menu-initiator:nth-child(1). Without a name, assistive technology cannot announce what the control opens.

Change

  • Menu gains an optional ariaLabel, rendered by the menu initiator on its button.
  • Only the icon-only remotion menu sets it (ariaLabel: 'Remotion').
  • Text menus keep their existing behavior: aria-label stays absent, so the visible label still names the control and no markup changes for them.

Semantics and keyboard operation are unchanged: the trigger keeps role="button" and its existing tabIndex.

Tests

packages/studio/src/test/menu-initiator-accessible-name.test.tsx

  • Icon-only trigger with ariaLabel: the button is queried by accessible name (getByRole('button', {name: 'Remotion'})) and keeps tabindex="0".
  • Control: a text menu keeps aria-label absent and is named by its visible label.

Verification on Windows 11 x64, Node/bun 1.4.3 (bun test src/test/menu-initiator-accessible-name.test.tsx):

  • With the change: 2 pass.
  • With the two production files reverted and the test kept: 1 fail, 1 pass — the icon-only case fails on the missing accessible name, the text-menu control still passes.
  • bun test src/test/composition-menu-items.test.ts: 8 pass, unchanged menu structure.
  • oxfmt --check clean; tsc -d for @remotion/studio passed as part of turbo run make --filter=@remotion/studio... (29 tasks).

Not done locally: eslint could not run on this checkout (ESLint couldn't find the plugin "eslint-plugin-react-hooks", resolved from packages/eslint-config-internal/dist), and the rendered Studio UI was not opened in a browser, so this does not claim a fresh Accessibility Insights scan. The rule it checks — a non-empty accessible name on the button — is what the new test asserts.

The top-left Studio menu is triggered by the Remotion icon alone, so the
button had no accessible name and `Accessibility Insights for Web` reported a
`button-name` (WCAG 4.1.2) failure for it.

`Menu` now carries an optional `ariaLabel` that the menu initiator renders on
its button. Only the icon-only Remotion menu sets it; text menus keep being
named by their visible label, where `aria-label` stays absent.

Fixes remotion-dev#12947
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bugs Ready Ready Preview Nov 4, 2026 11:30pm UTC
remotion Ready Ready Preview Nov 4, 2026 11:30pm UTC

Request Review

@pullfrog pullfrog Bot 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.

ℹ️ Minor suggestion inline. The fix is correct and the regression test is solid.

Reviewed changes

  • Icon-only trigger name: Adds ariaLabel to the internal Menu type and forwards it to the trigger's aria-label, so the Remotion logo button has an accessible name (WCAG 4.1.2).
  • Scoped wiring: Only the remotion menu sets ariaLabel: 'Remotion'; text menus keep their visible label and no aria-label attribute.
  • Regression test: Queries the trigger by accessible name and asserts text menus stay label-named, with a control case.

Verified locally: the new test passes (2/2), the related menu tests pass (13/13), and tsc --noEmit, oxlint/eslint, and oxfmt --check are clean for the touched files.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 | 𝕏

leaveLeftPadding: boolean;
// Declared when the label is only an icon, so the trigger keeps a
// discernible name for assistive technology.
ariaLabel?: string;

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 AGENTS.md and the nullable-new-params skill, new internal type members should be required nullable rather than optional. Menu is internal (not exported from the package entrypoint), so this should be ariaLabel: string | null, with the other Menu literals passing null explicitly.

Technical details
# Make `ariaLabel` required nullable

## Affected sites
- `packages/studio/src/components/Menu/MenuItem.tsx:59` — new optional member
- `packages/studio/src/helpers/use-menu-structure.tsx` — the other `Menu` literals (`getFileMenu` and the view/tools/help entries) need `ariaLabel: null`
- `packages/studio/src/components/ToolbarMenuItems.tsx:77` — composition menu literal
- `packages/studio/src/test/composition-menu-items.test.ts`, `packages/studio/src/test/quick-switcher-menu-results.test.ts`, and this PR's test — fixtures need the explicit `null`

## Required outcome
- Internal `Menu.ariaLabel` is `string | null`, and every construction site passes either the label or `null`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in 5fec286. Menu['ariaLabel'] is now string | null, and every construction site states it explicitly: use-menu-structure.tsx (file/view/composition/tools/help → null, remotion → 'Remotion'), ToolbarMenuItems.tsx, plus the three test fixtures.

The DOM attribute needed the repo's existing nullable convention, so the button now reads aria-label={menu.ariaLabel ?? undefined} (same shape as CaptionInspector.tsx:180 and RenderModalOutputName.tsx:91).

Verification:

  • Dropping ariaLabel from just ToolbarMenuItems.tsx fails the typecheck with TS2741: Property 'ariaLabel' is missing ... but required in type 'Menu', so the rule now enforces completeness at every site instead of only at the one I touched.
  • bun x turbo run make --filter=@remotion/studio: 29/29 tasks, no TS errors.
  • bun test on menu-initiator-accessible-name, composition-menu-items, quick-switcher-menu-results: 11 pass / 0 fail.
  • oxfmt --check clean on all six files.

Per AGENTS.md, new internal type members are required nullable rather than
optional, so every Menu literal now states whether it has an icon-only
label instead of silently inheriting undefined.
@JonnyBurger JonnyBurger changed the title fix(studio): give the icon-only menu trigger a discernible name @remotion/studio: give the icon-only menu trigger a discernible name Nov 5, 2026

@JonnyBurger JonnyBurger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will merge after current release is done

@JonnyBurger
JonnyBurger merged commit 6ec5af6 into remotion-dev:main Nov 5, 2026
21 checks passed

This branch was successfully deployed

2 active deployments
Preview – remotion — 5fec2867 Deployed Nov 4, 2026 by vercel[bot]
Preview – bugs — 5fec2867 Deployed Nov 4, 2026 by vercel[bot]
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.

Studio: Top-left menu button has no accessible name (WCAG 4.1.2)

2 participants