Skip to content

Commit 0772492

Browse files
committed
fix(form-field): inconsistent border width across outline gap in Chrome
Closes #10710. Chrome render borders that have non-integer widths differently when a border-radius is set. This adds an imperceptibly small border radius to the outline gap so that it renders the same as the outside borders.
1 parent a0c77e2 commit 0772492

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/lib/form-field/form-field-outline.scss

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,18 @@ $mat-form-field-outline-subscript-padding:
7979
}
8080

8181
.mat-form-field-outline-gap {
82-
border-bottom: $mat-form-field-outline-width solid currentColor;
83-
84-
&::before {
85-
content: '';
86-
display: block;
87-
width: 100%;
88-
border-top: $mat-form-field-outline-width solid currentColor;
89-
opacity: 1;
90-
transition: opacity 300ms $swift-ease-out-timing-function;
91-
}
82+
// hack for Chrome's treatment of border width on non-integer displays
83+
// refer to #10710
84+
border-radius: 0.000001px;
85+
border: $mat-form-field-outline-width solid currentColor;
86+
border-left-style: none;
87+
border-right-style: none;
88+
transition: border-color 300ms $swift-ease-out-timing-function;
9289
}
9390

9491
&.mat-form-field-can-float.mat-form-field-should-float {
95-
.mat-form-field-outline-gap::before {
96-
opacity: 0;
92+
.mat-form-field-outline-gap {
93+
border-top-color: transparent;
9794
}
9895
}
9996

@@ -102,11 +99,9 @@ $mat-form-field-outline-subscript-padding:
10299

103100
.mat-form-field-outline-start,
104101
.mat-form-field-outline-end,
105-
.mat-form-field-outline-gap,
106-
.mat-form-field-outline-gap::before {
102+
.mat-form-field-outline-gap {
107103
border-width: $mat-form-field-outline-thick-width;
108-
transition: border-color 300ms $swift-ease-out-timing-function,
109-
opacity 300ms $swift-ease-out-timing-function;
104+
transition: border-color 300ms $swift-ease-out-timing-function;
110105
}
111106
}
112107

0 commit comments

Comments
 (0)