Skip to content

[combobox][menu][select] Support Ctrl+N/Ctrl+P navigation on Apple platforms - #6316

Open
michaldudak wants to merge 3 commits into
mui:masterfrom
michaldudak:claude/ctrl-np-apple-navigation-3ebe22
Open

michaldudak wants to merge 3 commits into
mui:masterfrom
michaldudak:claude/ctrl-np-apple-navigation-3ebe22

Conversation

@michaldudak

@michaldudak michaldudak commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Closes #5146

On macOS and iOS, Ctrl+N and Ctrl+P move down and up a line in native text fields, menus and pop-up buttons. This makes them work as ↓ and ↑ in every list-navigation component: Combobox, Autocomplete, Select, Menu (including filterable menus), Context Menu and Menubar. On Windows and Linux the shortcuts clash with system and browser bindings, so they stay untouched there.

This replaces the reverted highlightItem() imperative action (#5586, reverted in #5910) with built-in, platform-native behavior. There is no new public API.

Behavior

  • A literal alias of ↓/↑: it opens a closed popup, respects orientation, loopFocus and grid rows, and reports reason: 'keyboard' to onItemHighlighted.
  • Only plain Ctrl. With Shift, Alt or Cmd added, the key goes through unchanged.
  • Gated on platform.os.apple (macOS and iOS/iPadOS).
  • The letter comes from event.key, so Dvorak users press the key labelled N. Layouts without Latin letters fall back to event.code.
  • Apps can opt out with event.preventBaseUIHandler() in their own onKeyDown.

Implementation

  • getNavigationKey(event) in utils/popups/event.ts returns ArrowDown/ArrowUp for the shortcut and event.key otherwise.
  • useListNavigation computes the key once per keydown and uses it wherever it read event.key, including keyRef, which decides whether opening lands on the first or last item.
  • getGridNavigatedIndex takes an optional key (defaulting to event.key, so its other callers are unchanged), and the injected gridNavigation passes it through.
  • ComboboxTrigger and ComboboxChip use the helper for their own open-on-arrow handling.
  • In filterable menus, the input's key routing (getMenuFilterKeyAction) resolves the key through the helper before treating modified keys as text editing, so the shortcut navigates instead of editing. The trigger relays it to the input like the vertical arrows.

Docs

One sentence in the "Keyboard navigation" section of the Accessibility page. The component pages have no keyboard section to put it in.

@code-infra-dashboard

code-infra-dashboard Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+226B(+0.04%) 🔺+134B(+0.08%)

Details of bundle changes

Performance

No regressions in 36 benchmarks · ran 3m 57s · details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1b4907b
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6b03fa5d313583e755db6240
😎 Deploy Preview https://deploy-preview-6316--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 20, 2026
@zannager zannager added component: combobox Changes related to the combobox component. component: menu Changes related to the menu component. component: select Changes related to the select component. labels Nov 20, 2026
@michaldudak
michaldudak force-pushed the claude/ctrl-np-apple-navigation-3ebe22 branch from 1043de0 to 410a0c5 Compare November 23, 2026 07:42
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 23, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

commit: 1b4907b

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component. component: menu Changes related to the menu component. component: select Changes related to the select component. PR: out-of-date The pull request has merge conflicts and can't be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autocomplete] Support vim-style Ctrl+N/Ctrl+P keyboard navigation

2 participants