Skip to content

Commit 1a3993e

Browse files
crisbetojosephperrott
authored andcommitted
fix(form-field,select): handle form field controls inside toolbar (#10627)
1 parent 54c0b00 commit 1a3993e

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/demo-app/toolbar/toolbar-demo.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
<span>Primary Toolbar</span>
2929
<span class="demo-fill-remaining"></span>
3030

31+
<mat-form-field>
32+
<mat-label>Select</mat-label>
33+
<mat-select>
34+
<mat-option value="1">One</mat-option>
35+
<mat-option value="2">Two</mat-option>
36+
</mat-select>
37+
</mat-form-field>
38+
39+
<mat-form-field appearance="legacy">
40+
<mat-label>Input</mat-label>
41+
<input matInput>
42+
</mat-form-field>
43+
3144
<button mat-raised-button>Text</button>
3245
<button mat-raised-button color="accent">Accent</button>
3346
<button mat-stroked-button>Stroked</button>
@@ -43,6 +56,19 @@
4356
<span>Accent Toolbar</span>
4457
<span class="demo-fill-remaining"></span>
4558

59+
<mat-form-field>
60+
<mat-label>Select</mat-label>
61+
<mat-select>
62+
<mat-option value="1">One</mat-option>
63+
<mat-option value="2">Two</mat-option>
64+
</mat-select>
65+
</mat-form-field>
66+
67+
<mat-form-field appearance="legacy">
68+
<mat-label>Input</mat-label>
69+
<input matInput>
70+
</mat-form-field>
71+
4672
<button mat-button>Text</button>
4773
<button mat-flat-button>Flat</button>
4874
<button mat-mini-fab color="">

src/lib/toolbar/_toolbar-theme.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
color: mat-color($palette, default-contrast);
99
}
1010

11+
@mixin _mat-toolbar-form-field-overrides {
12+
.mat-form-field-underline,
13+
.mat-form-field-ripple,
14+
.mat-focused .mat-form-field-ripple {
15+
background-color: currentColor;
16+
}
17+
18+
.mat-form-field-label,
19+
.mat-focused .mat-form-field-label,
20+
.mat-select-value,
21+
.mat-select-arrow,
22+
.mat-form-field.mat-focused .mat-select-arrow {
23+
color: inherit;
24+
}
25+
26+
.mat-input-element {
27+
caret-color: currentColor;
28+
}
29+
}
30+
1131
@mixin mat-toolbar-theme($theme) {
1232
$primary: map-get($theme, primary);
1333
$accent: map-get($theme, accent);
@@ -30,6 +50,8 @@
3050
&.mat-warn {
3151
@include _mat-toolbar-color($warn);
3252
}
53+
54+
@include _mat-toolbar-form-field-overrides;
3355
}
3456
}
3557

0 commit comments

Comments
 (0)