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

bug(MatChipOption): Unable to disable individual mat-chip-option when used inside a form tag and with template-driven forms #29783

Closed
1 task
gremlin896 opened this issue Sep 24, 2024 · 1 comment · Fixed by #29795
Assignees
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@gremlin896
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

[disabled] used on a mat-chip-option that is part of a mat-chip-listbox is ignored when used with template-driven forms and is there is a parent form tag used.

Reproduction

StackBlitz link: https://stackblitz.com/edit/84akr3-apxcdy

Two identical examples, but the first example is enclosed within <form>

Expected Behavior

In the first example, the first option should be disabled. As it is in the second example

Actual Behavior

In the first example, the first option is not disabled.

Environment

Angular CLI: 19.0.0-next.2
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

Angular: 19.0.0-next.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1900.0-next.2
@angular-devkit/build-angular 19.0.0-next.2
@angular-devkit/core 19.0.0-next.2
@angular-devkit/schematics 19.0.0-next.2
@schematics/angular 19.0.0-next.2
rxjs 7.4.0
typescript 5.5.4
zone.js 0.15.0

@gremlin896 gremlin896 added the needs triage This issue needs to be triaged by the team label Sep 24, 2024
@gremlin896 gremlin896 changed the title bug(MatChipOption): Unable to disable individual mat-chip-option when used inside a form tag and template-driven forms bug(MatChipOption): Unable to disable individual mat-chip-option when used inside a form tag and with template-driven forms Sep 24, 2024
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/chips and removed needs triage This issue needs to be triaged by the team labels Sep 27, 2024
@crisbeto crisbeto self-assigned this Sep 27, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 27, 2024
The chip set has been set up in a way where it syncs its state to the chips, instead of the other way around which we follow in other components. This means that if its `disabled` state changes later, it can ovewrite the state that the user explicitly set on the chip.

These changes make the logic a bit more robust by writing to a different field.

Fixes angular#29783.
crisbeto added a commit that referenced this issue Sep 30, 2024
The chip set has been set up in a way where it syncs its state to the chips, instead of the other way around which we follow in other components. This means that if its `disabled` state changes later, it can ovewrite the state that the user explicitly set on the chip.

These changes make the logic a bit more robust by writing to a different field.

Fixes #29783.

(cherry picked from commit 86ebb9b)
@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 Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants