Can not disable custom MatFormFieldControl with FormControl with mat-autocomplete
See original GitHub issueBug, feature request, or proposal:
- Potential bug
What is the expected behavior?
A component implementing MatFormFieldControl
with a mat-autocomplete
can be disabled correctly via a FormControl
.
What is the current behavior?
It is not possible to have a custom MatFormFieldControl
implementation with a mat-autocomplete
and have the input disabled via a FormControl
. Notice in the StackBlitz application, it is possible to open the autocomplete overlay of the field and select an option even when the field is set to disabled.
If the FormControl
is removed from the input
element in custom-input
and a binding to [disabled]
is used, the behaviour works as expected. The reason I am using a FormControl here is to automatically apply validators to the input, so they are not needed to be added manually by the consumer of the form field everywhere it is used.
It does however work correctly when adding matInput
to the input
element inside custom-input
. Is this the intended behaviour? The CDK Docs here do not include it.
What are the steps to reproduce?
https://stackblitz.com/edit/custom-mat-form-field-with-auto-complete
What is the use-case or motivation for changing an existing behavior?
To be able to disable the input when an autocomplete is attached, or be clearer in the docs when matInput
is needed still.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Latest from NPM (see StackBlitz)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Sorry, now I see what you mean. I’ll take a look at it.
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.