Why is there interference between mat-autocomplete and browser autocomplete?
See original GitHub issueBug:
Clicking on autocomplete opens browser autocomplete on top of material2 autocomplete Note: sometimes it takes a double click to re open the browser’s autocomplete.
Expected behavior:
Browser autocomplete should be disabled
Current implementation
<mat-form-field id="recipe-form__nations" >
<input type="text" matInput ngModel name="nation" placeholder="Nation" autocomplete="off" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let nation of nationalities" [value]="">
{{ nation }}
</mat-option>
</mat-autocomplete>
</mat-form-field>
Version in use?
"@angular/animations": "6.0.5",
"@angular/cdk": "^6.2.1",
"@angular/common": "6.0.5",
"@angular/compiler": "6.0.5",
"@angular/core": "6.0.5",
"@angular/forms": "6.0.5",
"@angular/http": "6.0.5",
"@angular/material": "^6.2.1",
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
angular - Why is Material 2 Autocomplete interfered by Browser ...
When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on...
Read more >Tk Angular Autocomplete - StackBlitz
import {MatNativeDateModule} from '@angular/. material';. import {BrowserModule} from '@angular/. platform-browser';. import {platformBrowserDynamic} from.
Read more >can't bind to 'matautocomplete' since it isn't a known property ...
If 'mat-autocomplete' is a Web Component then add 'CUSTOMELEMENTSSCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("nput ...
Read more >Autocomplete with Angular InstantSearch - Algolia
indices : the list of suggestions,; refine : a function that takes a query string and retrieves relevant suggestions. TypeScript.
Read more >Reusable Angular Material Input Autocomplete form control
The input's placeholder and the number of characters to trigger the ... Inner form control to link input text changes to mat autocomplete ......
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 FreeTop 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
Top GitHub Comments
Material does set
autocomplete="off"
, but it seems like browsers can ignore it in some cases (see https://stackoverflow.com/questions/12374442/chrome-browser-ignoring-autocomplete-off). I could work around it by setting it to a random value instead ofoff
(e.g.autocomplete="something"
), but I’m not sure what the accessibility implications might be if we rolled this into Material.I came here to complain that it’s still broken, but it turns out that you need a non-standard
autocomplete
attribute and aname
attribute, or you wind up with browser autofill.I don’t suppose a Googler on the Material team could talk to a Googler on the Chrome team about making this Just Work without us devs having to override the
autocomplete
attribute all the time? To be clear, with the way Chrome respectsautocomplete=off
(i.e., it doesn’t, at all), it never makes sense to allowautocomplete=off
in amatAutocompleteTrigger
; it should be a compile-time error, or ideally, Material should just magically fix it for you.