material-components / material-components/material-components-android

[Button] performClick() behavior when MaterialButton is disabled

Open
#5,019 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: Button
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

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

_Originally posted by @pubiqq in [#4967](https://github.com/material-components/material-components-android/pull/4967/changes#r2479703177)_

--

**Material Library version:** 1.14.0-alpha10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MaterialButton.performClick() and compare its disabled-state behavior with android.widget.Button and android.widget.CheckBox. Verify how click actions and toggle() behave when the button is disabled, then add or update coverage so the behavior is consistent and the disabled-state test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.