Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/dev-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -977,3 +977,39 @@ <h4>No defined label</h4>
</p>
</mat-card-content>
</mat-card>


<mat-card class="demo-card demo-basic">
<mat-toolbar color="primary">Basic outlined/filled fields with autofill attribue</mat-toolbar>
<mat-card-content>
<form>
<table style="width: 100%" cellspacing="0"><tr>
<td>
<mat-form-field style="width: 100%" appearance="outline">
<input matInput placeholder="First name" autofill="given-name">
</mat-form-field>
</td>
<td>
<mat-form-field style="width: 100%" appearance="fill">
<mat-label>Last name</mat-label>
<input matInput autofill="family-name" placeholder="Last name">
</mat-form-field>
</td>
</tr>
<tr>
<td>
<mat-form-field style="width: 100%" appearance="outline">
<mat-label>Home Address</mat-label>
<textarea matInput autofill="address" placeholder="Home address"></textarea>
</mat-form-field>
</td>
<td>
<mat-form-field style="width: 100%" appearance="fill">
<mat-label>Shipping</mat-label>
<textarea matInput autofill="address" placeholder="Shipping address"></textarea>
</mat-form-field>
</td>
</tr></table>
</form>
</mat-card-content>
</mat-card>
6 changes: 6 additions & 0 deletions src/material/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ $_icon-prefix-infix-padding: 4px;
&:has(textarea[cols]) {
width: auto;
}

input:-webkit-autofill,
textarea:-webkit-autofill {
-webkit-background-clip: text;
-webkit-text-fill-color: token-utils.slot(form-field-filled-input-text-color, $fallbacks);
}
}

// In the form-field theme, we add a 1px left margin to the notch to fix a rendering bug in Chrome.
Expand Down
Loading