Skip to content

Conversation

@mj12albert
Copy link
Member

Fixes #3875

@mj12albert mj12albert added component: switch Changes related to the switch component. component: checkbox Changes related to the checkbox component. labels Feb 2, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

commit: e7c6df6

@mui-bot
Copy link

mui-bot commented Feb 2, 2026

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+357B(+0.08%) 🔺+151B(+0.11%)

Details of bundle changes


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

@mj12albert mj12albert force-pushed the fix/button-control-modifier-keys branch from 5f8a7e4 to f1c9fa7 Compare February 2, 2026 11:39
@netlify
Copy link

netlify bot commented Feb 2, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 5f8a7e4
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69808c7c4f60c70008db96bf
😎 Deploy Preview https://deploy-preview-3935--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@netlify
Copy link

netlify bot commented Feb 2, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit e7c6df6
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6985def6fc942f0007e1c173
😎 Deploy Preview https://deploy-preview-3935--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍
Could it also be relevant for the Radio component? 🤔

@mj12albert mj12albert changed the title [checkbox][switch] Preserve modifier key properties in the change event [checkbox][radio][switch] Preserve modifier key properties in the change event Feb 2, 2026
@mj12albert mj12albert added the component: radio group Changes related to the radio group component. label Feb 2, 2026
@mj12albert mj12albert marked this pull request as ready for review February 2, 2026 13:28
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 2, 2026

Greptile Overview

Greptile Summary

Preserves keyboard modifier key properties (shift, ctrl, alt, meta) in change events for checkbox, radio, and switch components by replacing inputRef.current?.click() with inputRef.current?.dispatchEvent(new PointerEvent('click', {...})).

  • Modified the onClick handlers in CheckboxRoot.tsx, RadioRoot.tsx, and SwitchRoot.tsx to dispatch synthetic PointerEvent instances with modifier key properties
  • Added comprehensive tests for all three components to verify that modifier keys are correctly preserved and passed to the onCheckedChange / onValueChange callbacks
  • The synthetic event is configured with bubbles: true to match the behavior of native click events

Confidence Score: 5/5

  • This PR is safe to merge with no risks
  • The changes are well-isolated, correctly implemented, and thoroughly tested. The approach properly preserves modifier key properties without affecting existing functionality.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/checkbox/root/CheckboxRoot.tsx Replaced .click() with dispatchEvent(new PointerEvent()) to preserve modifier keys (shift, ctrl, alt, meta) in the change event
packages/react/src/radio/root/RadioRoot.tsx Replaced .click() with dispatchEvent(new PointerEvent()) to preserve modifier keys (shift, ctrl, alt, meta) in the change event
packages/react/src/switch/root/SwitchRoot.tsx Replaced .click() with dispatchEvent(new PointerEvent()) to preserve modifier keys (shift, ctrl, alt, meta) in the change event

@mj12albert mj12albert merged commit cca68a5 into mui:master Feb 6, 2026
23 checks passed
@mj12albert mj12albert deleted the fix/button-control-modifier-keys branch February 6, 2026 12:43
@cgatian
Copy link
Contributor

cgatian commented Feb 6, 2026

@mj12albert thank you!!

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

Labels

component: checkbox Changes related to the checkbox component. component: radio group Changes related to the radio group component. component: switch Changes related to the switch component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[checkbox] event.shiftkey always false

5 participants