Skip to content

[otp field] Support ctrl/cmd keyboard shortcuts - #4606

Merged
atomiks merged 2 commits into
mui:masterfrom
atomiks:codex/otp-field-ctrl-cmd-shortcuts
Apr 30, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
atomiks:codex/otp-field-ctrl-cmd-shortcuts

Conversation

@atomiks

@atomiks atomiks commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

The OTP field only handled plain arrow, Home/End, and Backspace keyboard paths, so common Ctrl/Cmd shortcuts were ignored. This maps Ctrl/Cmd + ArrowLeft and ArrowRight to the same boundary targets as Home/End and routes Ctrl/Cmd + Backspace through the existing keyboard update path to clear the full code.

Changes

  • Add Ctrl/Cmd + ArrowLeft and ArrowRight handling to move to the start or end of the filled OTP.
  • Add Ctrl/Cmd + Backspace handling to clear the full OTP value and refocus the first slot.
  • Add jsdom and Chromium regression coverage for both Ctrl and Cmd modifiers while simplifying the new modifier test cases.

@atomiks atomiks added type: bug It doesn't behave as expected. component: otp field labels Apr 14, 2026 — with ChatGPT Codex Connector
@pkg-pr-new

pkg-pr-new Bot commented Apr 14, 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@4606
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4606
    

commit: c3f2dcb

@code-infra-dashboard

code-infra-dashboard Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+69B(+0.01%) 🔺+37B(+0.03%)

Details of bundle changes

Performance

Total duration: 1,179.55 ms ▼-43.84 ms(-3.6%) | Renders: 53 (+0) | Paint: 1,841.82 ms -26.89 ms(-1.4%)

Test Duration Renders
Menu mount (300 instances) 133.72 ms 🔺+9.36 ms(+7.5%) 2 (+0)
Scroll Area mount (300 instances) 89.57 ms 🔺+4.72 ms(+5.6%) 3 (+0)
Menu open (500 items) 65.90 ms 🔺+2.62 ms(+4.1%) 12 (+0)
Select mount (200 instances) 112.84 ms ▼-26.70 ms(-19.1%) 3 (+0)
Dialog mount (300 instances) 70.59 ms ▼-7.96 ms(-10.1%) 2 (+0)

…and 7 more — details


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

@netlify

netlify Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c3f2dcb
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69f3e8065f8d6a0009a3d452
😎 Deploy Preview https://deploy-preview-4606--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 April 14, 2026 06:57
@atomiks
atomiks merged commit b20d718 into mui:master Apr 30, 2026
6 checks passed
@atomiks
atomiks deleted the codex/otp-field-ctrl-cmd-shortcuts branch April 30, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: otp field type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants