Skip to content

[menu] Keep filter input focus when pressing non-item list content - #5840

Merged
atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/filterable-menu-focus-93ef00
Oct 2, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/filterable-menu-focus-93ef00

Conversation

@atomiks

@atomiks atomiks commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

In a filterable menu, pressing a group, group label, or separator moved focus from the input to the list (which is focusable with tabIndex={-1}) and left it there. Only presses on the list's own background were kept off it.

This PR hands focus back to the input when the list takes it from the input, matching how Combobox handles presses on its list. Focus that reaches the list some other way, such as a tap in a touch-opened menu where the input was never focused, stays put so the on-screen keyboard doesn't open.

The list's background mousedown cancel and its scrollbar-press detection are no longer needed and have been removed. Scrollbar track presses and thumb drags still scroll normally and end with the input focused, the same as Combobox.

@atomiks atomiks added component: menu Changes related to the menu component. type: bug It doesn't behave as expected. internal Behind-the-scenes enhancement. Formerly called “core”. labels Oct 1, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5840
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5840
    

commit: 3d138d5

@code-infra-dashboard

code-infra-dashboard Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-280B(-0.05%) ▼-61B(-0.04%)

Details of bundle changes

Performance

Total duration: 538.44 ms 🔺+99.43 ms(+22.6%) | Renders: 76 (+0) | Paint: 976.20 ms 🔺+171.06 ms(+21.2%)

Test Duration Renders
Select mount (200 instances) 76.25 ms 🔺+24.73 ms(+48.0%) 3 (+0)
Mixed surface mount (app-like density) 54.21 ms 🔺+19.41 ms(+55.8%) 5 (+0)
Scroll Area mount (300 instances) 45.56 ms 🔺+11.48 ms(+33.7%) 3 (+0)
Menu mount (300 instances) 31.18 ms 🔺+10.05 ms(+47.6%) 1 (+0)
Menu open (500 items) 29.59 ms 🔺+9.90 ms(+50.3%) 11 (+0)

…and 4 more (+6 within noise) — details

Metric alarms

Test Metric Change
Select mount (200 instances) bench:paint 🔺 +36.02 ms
Mixed surface mount (app-like density) bench:paint 🔺 +29.93 ms
Scroll Area mount (300 instances) bench:paint 🔺 +17.81 ms
Menu mount (300 instances) bench:paint 🔺 +15.61 ms
Menu open (500 items) bench:paint 🔺 +21.26 ms

…and 8 more metric alarms — details


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

@netlify

netlify Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 3d138d5
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6abf85157563600008cf1620
😎 Deploy Preview https://deploy-preview-5840--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.

@atomiks
atomiks marked this pull request as ready for review October 1, 2026 12:21
@atomiks
atomiks merged commit bef10c5 into mui:master Oct 2, 2026
24 checks passed
@atomiks
atomiks deleted the claude/filterable-menu-focus-93ef00 branch October 2, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: menu Changes related to the menu component. internal Behind-the-scenes enhancement. Formerly called “core”. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant