Skip to content

[radio group] Honor canceled value changes - #4996

Merged
atomiks merged 4 commits into
mui:masterfrom
atomiks:codex/radio-cancelled-change-field-state
Jun 11, 2026
Merged

atomiks merged 4 commits into
mui:masterfrom
atomiks:codex/radio-cancelled-change-field-state

Conversation

@atomiks

@atomiks atomiks commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Canceling RadioGroup.onValueChange now leaves the radio value and field state unchanged.

Root cause

Radio.Root marked the field touched before RadioGroup ran the cancellable value-change handler.

Changes

  • Ran the cancellable radio value change before updating field touched state.
  • Left dirty and filled updates tied to committed group value changes.
  • Added cancellation coverage for root and hidden input clicks.

@atomiks atomiks added component: radio group Changes related to the radio group component. type: bug It doesn't behave as expected. labels Jun 10, 2026 — with ChatGPT Codex Connector
@pkg-pr-new

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

commit: 8d7c4a4

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-95B(-0.02%) ▼-35B(-0.02%)

Details of bundle changes

Performance

Total duration: 1,235.92 ms -214.44 ms(-14.8%) | Renders: 50 (+0) | Paint: 1,863.18 ms -308.60 ms(-14.2%)

Test Duration Renders
Menu mount (300 instances) 129.46 ms ▼-42.90 ms(-24.9%) 2 (+0)
Select mount (200 instances) 133.00 ms ▼-41.21 ms(-23.7%) 3 (+0)
Mixed surface mount (app-like density) 71.06 ms ▼-32.89 ms(-31.6%) 5 (+0)
Menu open (500 items) 70.10 ms ▼-18.32 ms(-20.7%) 12 (+0)
Dialog mount (300 instances) 51.86 ms ▼-16.67 ms(-24.3%) 1 (+0)

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


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

@atomiks
atomiks marked this pull request as ready for review June 10, 2026 07:18
@netlify

netlify Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 8d7c4a4
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a2a1337e14f70000867ea52
😎 Deploy Preview https://deploy-preview-4996--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 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Code Review (GPT-5.5)

Approve ✅ No actionable issues found; canceled radio value changes leave value and field state untouched, while successful keyboard selection still marks the field touched.

1. Bugs / Issues (None)

State / Interaction Assessment

The cancellation path now runs the cancellable group value-change flow before mutating field touched state. If the change is canceled, RadioRoot returns before setFieldTouched(true), so checked, touched, dirty, and filled state remain unchanged. Arrow keydown no longer marks the field touched directly; for a successful arrow selection, focus moves to the next radio and the hidden-input change path commits the value, then marks the field touched after the non-canceled details are known.

Test Coverage Assessment

The PR covers root click, hidden input click, and arrow navigation cancellation, plus the successful arrow-navigation touched path. Targeted validation passed:

  • pnpm test:chromium RadioGroup --no-watch
  • pnpm test:jsdom RadioGroup --no-watch

Performance / Operational Risk

Evidence Result Review take
code-infra bot -95B parsed, -35B gzip; total duration -214.44ms; paint -308.60ms; renders +0 No blocker; the branch reduces field-state work on canceled changes and the aggregate bot signal is favorable.

@atomiks
atomiks merged commit 200aba3 into mui:master Jun 11, 2026
6 checks passed
@atomiks
atomiks deleted the codex/radio-cancelled-change-field-state branch June 11, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: radio group Changes related to the radio group component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant