-
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
mat-autocomplete value not updating with browser autofill #9704
Comments
@crisbeto assigning to you since this seems specific to the autocomplete |
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes angular#9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes angular#9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes angular#9704.
I also have this problem. My form control's value is not updating after a browser autofill and it is causing my validation to not work for autocomplete with control's set to updateOn: 'blur' document.getElementById('input-email')['value']; // "email@example.com" Angular 6.1.3 Thanks! |
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
For anyone else, I'm using the following workaround import { Component, Inject, ViewChild } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { MatAutocompleteTrigger } from '@angular/material';
@Component({
...
template: `
<input
autocomplete="address-level1"
(input)="onInput($event)"
[matAutocomplete]="myAutocomplete"
matInput
#myAutocompleteTrigger="matAutocompleteTrigger">
<mat-autocomplete #myAutocomplete="matAutocomplete">
...
</mat-autocomplete>
`
})
export class MyComponent {
@ViewChild('myAutocompleteTrigger') private _myAutocompleteTrigger: MatAutocompleteTrigger;
constructor(@Inject(DOCUMENT) private _document: Document) {
}
onInput = (event: KeyboardEvent) => {
const target = event.currentTarget as HTMLInputElement;
if (this._document.activeElement !== target) {
this._myAutocompleteTrigger._onChange(target.value);
}
}
} |
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
… form control Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes angular#9704.
… form control (#9887) Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
… form control (#9887) Currently we skip any `input` events on an autocomplete trigger that have been dispatched while the element is blurre, in order to handle some IE-specific cases. This ends up preventing the autocomplete from picking up any changes to its value that have come as a result of the browser autofill. These changes move some logic around to handle both autofilling and the IE issues. Fixes #9704.
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:
Bug.
What is the expected behavior?
FormControl value should change when using browser autofill to complete the address.
What is the current behavior?
FormControl value does not change. Validation fails on the field.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-autocomplete-with-autofill
Start typing in the Name field. Use browser autofill to automatically fill out the rest of the form.
It seems as though the "Address line 1" field, which is controlled by a mat-autocomplete, fails to update after autofill, causing validation to fail.
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 5.2.1
Material: 5.1.0
Browser: Chrome 64.0.3282.119
The text was updated successfully, but these errors were encountered: