Skip to content

Conversation

@pubiqq
Copy link
Contributor

@pubiqq pubiqq commented Oct 29, 2025

Also fixes #4966.


@Override
public boolean performClick() {
if (isEnabled() && materialButtonHelper.isToggleCheckedStateOnClick()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@pubiqq thanks for the PR - can you explain why the isEnabled() check is removed? is it because perfomClick() should already never be called if the button is disabled? if so, I agree that the user can't click a disabled button, but it's possible that this method is called programmatically on a disabled button, so maybe we should keep it and do isEnabled() && isCheckable() && materialButtonHelper.isToggleCheckedStateOnClick()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Components such as android.widget.Button and android.widget.CheckBox perform click actions when the performClick method is called, even if they're disabled. I see no reason why the MaterialButton should be any different.

Also, the original implementation is incorrect because clicking on the disabled button works inconsistently; it doesn't invoke the toggle() method, but still performs click actions.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MaterialButtonToggleGroup] Double click sound on button press

2 participants