forms: update required validator when input is autofilled
See original GitHub issueπ feature request
Relevant Package
This feature request is for @angular/formsDescription
The RequiredValidator
does not update its validation status when an input is autofilled in Chrome. This is problematic for users who set up a required username and password input and then conditionally enable the submit button when the inputs are valid. The user sees:
- Page loads
- Inputs are autofilled with username and password
- Submit button is still disabled.
This issue has been filed in the past on the components repo: https://github.com/angular/components/issues/3414, though the change would really have to happen in @angular/forms.
Describe the solution youβd like
@angular/cdk has an AutofillMonitor
that could be moved to @angular/forms and used to detect when an input is autofilled.
Describe alternatives youβve considered
It is possible to monkey patch a solution, as @kherock demonstrated on the components issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:39
- Comments:20 (6 by maintainers)
Top Results From Across the Web
Angular 9 - Form not valid onInit if input autofilled by Browser
So the checkAndLoadUserInfo() should not require a parameter. ... Both ways will trigger validation and update the form's state.
Read more >Autofill - web.dev
Ensure autofill works for all your fields #ββ Found an appropriate value for your form field? Add it. Using suitable values for the...
Read more >4.10 Forms - HTML Standard - whatwg
The simplest annotation is the required attribute, which can be specified on input elements to indicate that the form is not to be...
Read more >950510 - Firefox autofill doesn't trigger updating in Angular
Actual results: The textbox autofills, but the framework cannot detect this, and so it never picks up the change. Expected results: Firefox should...
Read more >How to trigger input field change with Google Chrome autofill ...
<form class="needs-validation"> <div class="form-group"> <input v-model="form.first_name" type="text" class="form-control" required>Β ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Why is it marked as feature? IMO itβs a bug and shouldnβt need votes to fix it.
Nothing is helping. No matter whether u have a form or u use ngModel, whether u put all these directives floating around internet posts with autofillmonitor or with directives to react on input change. UNLESS you really tap ie focus/touch input - value does not appear. Mind you i have everything setup - associated domains, webcredentials etc