Skip to content

refactor(ui): Menu interaction and accessibility improvements#8333

Merged
alexcarpenter merged 5 commits into
mainfrom
carp/menu-interaction-improvements
Jun 18, 2026
Merged

refactor(ui): Menu interaction and accessibility improvements#8333
alexcarpenter merged 5 commits into
mainfrom
carp/menu-interaction-improvements

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Apr 16, 2026

Copy link
Copy Markdown
Member

Description

Improve Menu keyboard navigation and accessibility. Menus now support Enter/Space to open from the trigger, ArrowDown/ArrowUp/Home/End to move focus, Escape to close and return focus to the trigger, and skip disabled items during arrow-key navigation. Menus no longer mark the rest of the page as aria-hidden while open, so assistive technologies can still reach surrounding content.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Release Notes

  • New Features

    • Menu trigger now supports keyboard activation with Enter/Space keys.
    • Menu navigation with Arrow keys (Up/Down/Home/End), automatically skipping disabled items.
    • Menu closes with Escape key, restoring focus to the trigger.
    • Popover component now includes configurable focus-trapping behavior via new modal prop.
  • Bug Fixes

    • Menu no longer applies aria-hidden to surrounding page content, improving assistive technology access.
  • Tests

    • Added comprehensive keyboard and accessibility test coverage for Menu component.

@changeset-bot

changeset-bot Bot commented Apr 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8d4b8cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Apr 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 18, 2026 12:32pm
swingset Ready Ready Preview, Comment Jun 18, 2026 12:32pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 95c123bf-6647-4f7a-80f5-427ae2c10b83

📥 Commits

Reviewing files that changed from the base of the PR and between ab8f5aa and b29716c.

📒 Files selected for processing (1)
  • .changeset/menu-keyboard-a11y.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/menu-keyboard-a11y.md

📝 Walkthrough

Walkthrough

The PR documents Menu keyboard accessibility enhancements and focus management changes in a changeset entry. The changeset records support for trigger activation via Enter/Space keys, in-menu navigation using arrow keys and Home/End, and Escape to close while restoring focus to the trigger. It also notes that disabled items are skipped during navigation, and that page-wide aria-hidden is no longer applied while a menu is open.

Changes

Menu keyboard and a11y updates

Layer / File(s) Summary
Menu keyboard and a11y changeset
.changeset/menu-keyboard-a11y.md
Patch-level changeset entry for @clerk/ui documenting trigger keyboard activation (Enter/Space), in-menu navigation (arrow keys, Home, End with disabled-item skipping), menu close via Escape with focus return, and removal of page-wide aria-hidden behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • LauraBeatris
  • Ephem

Poem

🐰 With arrow keys and Enter's call,
The menu springs and heeds them all,
Escape brings focus back to place,
No aria-hidden hides the space!
Accessibility takes the stage. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(ui): Menu interaction and accessibility improvements' accurately and clearly summarizes the main changes in the PR—enhancing Menu keyboard navigation and accessibility with Floating UI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ui/src/elements/Menu.tsx`:
- Around line 96-103: The prop rename from arialLabel to ariaLabel in
MenuTrigger/MenuTriggerProps is a breaking change; restore backward
compatibility by accepting both names: update MenuTriggerProps to allow
ariaLabel?: string | ((open: boolean) => string) and a deprecated arialLabel?:
string | ((open: boolean) => string), then in MenuTrigger compute the effective
label by preferring ariaLabel when present and falling back to arialLabel (e.g.,
derive normalizedAriaLabel from ariaLabel if defined, otherwise arialLabel), and
document/mark arialLabel as deprecated so consumers have a compatibility window;
ensure getReferenceProps/usage uses the normalized value.
- Around line 65-71: Add a regression test that renders the Menu component using
the same composition that wires useListNavigation and SimpleButton (i.e., Menu
with three items where the middle item has isDisabled) and assert keyboard arrow
navigation skips the disabled item: simulate focus on the first item, send
ArrowDown (and ArrowUp) key events, and verify focus moves from the first item
directly to the third item (and vice versa) rather than landing on the disabled
SimpleButton; reference the Menu component, useListNavigation, SimpleButton and
the isDisabled prop when locating code to test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 9e51c4b4-043b-46d4-8292-2788f995a779

📥 Commits

Reviewing files that changed from the base of the PR and between 45b773a and cf5437f.

📒 Files selected for processing (6)
  • .changeset/menu-keyboard-a11y.md
  • packages/ui/src/components/UserProfile/__tests__/ConnectedAccountsSection.test.tsx
  • packages/ui/src/elements/Menu.tsx
  • packages/ui/src/elements/Popover.tsx
  • packages/ui/src/elements/ThreeDotsMenu.tsx
  • packages/ui/src/elements/__tests__/Menu.test.tsx

Comment thread packages/ui/src/elements/Menu.tsx
Comment thread packages/ui/src/elements/Menu.tsx
@pkg-pr-new

pkg-pr-new Bot commented Apr 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8333

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8333

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8333

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8333

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@8333

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8333

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8333

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8333

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8333

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8333

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8333

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8333

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8333

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8333

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8333

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8333

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8333

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8333

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8333

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8333

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8333

commit: 8d4b8cc

@wobsoriano wobsoriano 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.

sweet!

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T12:34:42.809Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 8d4b8cc.

@alexcarpenter alexcarpenter merged commit 57a58ac into main Jun 18, 2026
47 checks passed
@alexcarpenter alexcarpenter deleted the carp/menu-interaction-improvements branch June 18, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants