Skip to content

Commit 9145675

Browse files
crisbetoannieyw
authored andcommitted
fix(material/input): uncessary scroll bar on auto-resize textarea in some cases (#21619)
It's common for apps to set `box-sizing: border-box` on all elements in the app which ends up causing unnecessary scroll bars on auto-resizing textareas. These changes explicitly set `box-sizing: content-box` to fix it. Note that ideally we'd do this at the `cdk/text-field` level since it is the one responsible for resizing the textarea, but we generally try to avoid changing the user's layout through the CDK. Fixes #21560. (cherry picked from commit 915791b)
1 parent 6ae8f62 commit 9145675

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/material/form-field/form-field-input.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
// placeholder, the alignment should be inherited here.
3333
text-align: inherit;
3434

35+
// It's common for developers to set `box-sizing: border-box` on every element on the page.
36+
// Reset it to `content-box` since all of our styles are written with it in mind. `border-box`
37+
// can also cause unnecessary scrollbars on auto-resizing textareas (see #21560).
38+
box-sizing: content-box;
39+
3540
// Undo the red box-shadow glow added by Firefox on invalid inputs.
3641
// See https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-invalid
3742
&:-moz-ui-invalid {

0 commit comments

Comments
 (0)