Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MdCheckbox disabled by FormControl API cannot be enabled if clicked while disabled #4037

Closed
arlowhite opened this issue Apr 11, 2017 · 3 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@arlowhite
Copy link

Bug, feature request, or proposal:

Hookup a MdCheckbox to a FormControl.
disable(), try to click check, and enable() the form control.
Checkbox appears enabled but cannot be focused or checked/un-checked.

What is the expected behavior?

Checkbox should be able to be disabled/enabled using FormControl API and user interacting with disabled checkbox should not break it.

What is the current behavior?

  1. checkbox works fine initially
  2. disable()
  3. Try clicking checkbox. First click causes ripple effect on check. More clicks do nothing
  4. enable()
  5. style changes to primary color, but cannot be clicked. Also, cannot be tab-focused

Sometimes I see:

ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.

This seems to depend on whether you toggled the checkbox before disabling it.

What are the steps to reproduce?

https://github.com/arlowhite/material2/tree/checkbox-control-disable-bug
npm run demo-app
Go to Input
Scroll to Checkbox BUG

Which versions of Angular, Material, OS, browsers are affected?

angular2 master 9d719c5
Ran npm update in material2 project April 11th
Angular 4.0.1

Affects Chrome and Firefox; haven't tried others.

@arlowhite
Copy link
Author

Also, in my own app with a ReactiveForm FormGroup, the checkbox is broken after disable()/enable() even without interacting with it. I call disable() in response to the entire form's valueChanges.

This would be more difficult to create a demo for. But after you push a fix to master I can test if the bug went away in my own app.

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Apr 11, 2017
@mmacfadden
Copy link

We are also experiencing this same issue.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

4 participants