angular / angular/angular

forms: update required validator when input is autofilled

Open
#30,616 39 comments 57 reactions 1 assignee Claimed by @JeanMeche View on GitHub
area: docs area: forms feature: under consideration forms: change detection forms: validators P5 type: bug/fix
Dominant language
TypeScript
Stars
101k
Forks
27.5k
Avg merge
1d 19h
Merged PRs (30d)
288

Description

# 🚀 feature request

### Relevant Package

This feature request is for @angular/forms

### Description
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:

1. Page loads
2. Inputs are autofilled with username and password
3. 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](https://stackblitz.com/edit/autofillmon-validate?file=app/autofillvalueaccessor.directive.ts) on the components issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.