Skip to content

[radio] Prevent ignored arrow keys from selecting on refocus - #5643

Merged
atomiks merged 4 commits into
mui:masterfrom
tjdsksro90:fix/radio-ignored-arrow-selection
Sep 10, 2026
Merged

atomiks merged 4 commits into
mui:masterfrom
tjdsksro90:fix/radio-ignored-arrow-selection

Conversation

@tjdsksro90

Copy link
Copy Markdown
Contributor

Fixes #5626.

Problem

RadioGroup arms selection-on-focus for every arrow key, including Alt, Control, and Meta combinations that composite navigation ignores.

When focus does not move, the pending selection state survives leaving the group. Returning via Tab then selects a radio without an intentional selection action. This also occurs when only one radio is enabled.

Changes

  • Ignore Alt, Control, and Meta arrow combinations when arming selection-on-focus, while preserving Shift+arrow navigation.
  • Clear the pending selection state when focus leaves the group.
  • Add eight regression cases covering these modifier combinations and the single-enabled-radio case with both non-native and native button rendering.

Verification

All eight new regression cases fail before the fix in both JSDOM and Chromium and pass after it.

  • pnpm test:jsdom RadioGroup --no-watch — 100 passed, 13 skipped
  • pnpm test:chromium RadioGroup --no-watch — 113 passed
  • pnpm typescript — passed
  • pnpm eslint — passed
  • pnpm stylelint — passed
  • pnpm prettier — passed

Existing ordinary-arrow and Shift+arrow navigation tests continue to pass.

The full test suite and other browser engines were not run locally.

@pkg-pr-new

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

commit: 984351f

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+6B(0.00%) 🔺+3B(0.00%)

Details of bundle changes

Performance

Total duration: 1,040.50 ms -97.38 ms(-8.6%) | Renders: 76 (+0) | Paint: 1,682.68 ms -151.01 ms(-8.2%)

Test Duration Renders
Select mount (200 instances) 122.10 ms ▼-32.27 ms(-20.9%) 3 (+0)
Combobox type — 500 items, all stay mounted (type "Row ") 29.65 ms ▼-8.24 ms(-21.7%) 11 (+0)

13 tests within noise — details


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

@netlify

netlify Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

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

@zannager zannager added the radio label Sep 8, 2026

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

Thanks for the fix

@atomiks
atomiks merged commit e6d1d40 into mui:master Sep 10, 2026
24 checks passed
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.

[radio] An arrow key the group ignores still arms "select the next radio to take focus"

3 participants