Skip to content

[ButtonBase] Key handlers should not run on a disabled non-native button#48003

Merged
mj12albert merged 3 commits intomui:masterfrom
mj12albert:fix/disabled-button-base-key-handlers
Mar 17, 2026
Merged

[ButtonBase] Key handlers should not run on a disabled non-native button#48003
mj12albert merged 3 commits intomui:masterfrom
mj12albert:fix/disabled-button-base-key-handlers

Conversation

@mj12albert
Copy link
Member

Minor breaking change: Disabled non-native ButtonBase (e.g. a span) can still be programmatically focused when disabled and incorrectly fire key events.

Doesn't not affect any Material UI components that internally use ButtonBase, the change would only affect users directly using ButtonBase to render a non-native button, and somehow relying on key events firing on it when disabled

@mj12albert mj12albert added breaking change Introduces changes that are not backward compatible. component: ButtonBase The React component. labels Mar 17, 2026
@mui-bot
Copy link

mui-bot commented Mar 17, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+10B(0.00%) 🔺+5B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 35b4a21

@mj12albert mj12albert marked this pull request as ready for review March 17, 2026 08:24
@mj12albert mj12albert changed the title [ButtonBase] Key handlers return when disabled [ButtonBase] Key handlers should not run when rendering a disabled non-native button Mar 17, 2026
@mj12albert mj12albert changed the title [ButtonBase] Key handlers should not run when rendering a disabled non-native button [ButtonBase] Key handlers should not run on a disabled non-native button Mar 17, 2026
Copy link
Member

@silviuaavram silviuaavram left a comment

Choose a reason for hiding this comment

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

Looks good! Since it's a breaking change, maybe we need to mention it in the upgrade guide? What do you think?

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

If it's breaking change, it should be added to the upgrade guide

@mj12albert mj12albert added the type: bug It doesn't behave as expected. label Mar 17, 2026
@mj12albert mj12albert merged commit 694eec9 into mui:master Mar 17, 2026
24 checks passed
@mj12albert mj12albert deleted the fix/disabled-button-base-key-handlers branch March 17, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. component: ButtonBase The React component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants