-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Can not disable custom MatFormFieldControl with FormControl with mat-autocomplete #8735
Comments
Your example breaks because you don't disable underlying |
@crisbeto I'm using a FormControl to disable the input, as using both a FormControl and binding with |
Yes, otherwise users will still be able to focus and type into the input. |
How does this work then when I remove the reference to |
Sorry, now I see what you mean. I'll take a look at it. |
…eAccessor Fixes plain inputs (without a `matInput`) that has a `formControl` and an autocomplete attached not being disabled via `FormControl.disable`. The issue was due to the `MatAutocompleteTrigger` not implementing the `setDisableState`. The current implementation is in line with the approach in the `DefaultValueAccessor`. Fixes angular#8735.
…eAccessor Fixes plain inputs (without a `matInput`) that has a `formControl` and an autocomplete attached not being disabled via `FormControl.disable`. The issue was due to the `MatAutocompleteTrigger` not implementing the `setDisableState`. The current implementation is in line with the approach in the `DefaultValueAccessor`. Fixes angular#8735.
…eAccessor Fixes plain inputs (without a `matInput`) that has a `formControl` and an autocomplete attached not being disabled via `FormControl.disable`. The issue was due to the `MatAutocompleteTrigger` not implementing the `setDisableState`. The current implementation is in line with the approach in the `DefaultValueAccessor`. Fixes angular#8735.
Meet the same issue. Can't disable the input in mat-autocomplete component when using FormControl...Is this issue fixed? |
…eAccessor (#8746) Fixes plain inputs (without a `matInput`) that has a `formControl` and an autocomplete attached not being disabled via `FormControl.disable`. The issue was due to the `MatAutocompleteTrigger` not implementing the `setDisableState`. The current implementation is in line with the approach in the `DefaultValueAccessor`. Fixes #8735.
…eAccessor (angular#8746) Fixes plain inputs (without a `matInput`) that has a `formControl` and an autocomplete attached not being disabled via `FormControl.disable`. The issue was due to the `MatAutocompleteTrigger` not implementing the `setDisableState`. The current implementation is in line with the approach in the `DefaultValueAccessor`. Fixes angular#8735.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
What is the expected behavior?
A component implementing
MatFormFieldControl
with amat-autocomplete
can be disabled correctly via aFormControl
.What is the current behavior?
It is not possible to have a custom
MatFormFieldControl
implementation with amat-autocomplete
and have the input disabled via aFormControl
. 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 theinput
element incustom-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 theinput
element insidecustom-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)
The text was updated successfully, but these errors were encountered: