Skip to content

Commit 7c59b35

Browse files
devversionandrewseguin
authored andcommitted
fix(material-experimental/mdc-form-field): do not show focus overlay when disabled
Fixes that the focus overlay is rendered/displayed when the form-field is disabled. We fix this by just not rendering the focus overlay when the form field is disabled. This should be better, compared to leaving it in the DOM while toggling opacity or `display: none`, because it saves bytes in SSR rendered apps, and helps reducing DOM nodes. The assumption is that form-field's disabled state doesn't change constantly.
1 parent 445525f commit 7c59b35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/material-experimental/mdc-form-field/form-field.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
[class.mdc-text-field--disabled]="_control.disabled"
3535
[class.mdc-text-field--invalid]="_control.errorState"
3636
(click)="_control.onContainerClick && _control.onContainerClick($event)">
37-
<div class="mat-mdc-form-field-focus-overlay" *ngIf="!_hasOutline()"></div>
37+
<div class="mat-mdc-form-field-focus-overlay" *ngIf="!_hasOutline() && !_control.disabled"></div>
3838
<div class="mat-mdc-form-field-flex">
3939
<div *ngIf="_hasOutline()" matFormFieldNotchedOutline
4040
[matFormFieldNotchedOutlineOpen]="_shouldLabelFloat()"

0 commit comments

Comments
 (0)