Skip to content

Commit fbf28d9

Browse files
committed
fix(form-field): label gap not being calculated when switching to outline dynamically
Fixes the form field gap not being calculated if the field switches to the `outline` appearance after init. Fixes #11653.
1 parent 9f6aa84 commit fbf28d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/form-field/form-field.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ export class MatFormField extends _MatFormFieldMixinBase
148148
return this._appearance || this._defaultOptions && this._defaultOptions.appearance || 'legacy';
149149
}
150150
set appearance(value: MatFormFieldAppearance) {
151+
// If we're switching to `outline` from another appearance, we have to recalculate the gap.
152+
if (value !== this._appearance && value === 'outline') {
153+
this._initialGapCalculated = false;
154+
}
155+
151156
this._appearance = value;
152157
}
153158
_appearance: MatFormFieldAppearance;

0 commit comments

Comments
 (0)