-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(form-field): scrollbars appear on autosize textarea in chrome #10811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/cdk/text-field/_text-field.scss
Outdated
@@ -19,6 +19,13 @@ | |||
textarea.cdk-textarea-autosize { | |||
resize: none; | |||
} | |||
|
|||
textarea.cdk-textarea-autosize-measuring { | |||
height: auto !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments that explains what this class is for and the use of !important
?
src/cdk/text-field/_text-field.scss
Outdated
textarea.cdk-textarea-autosize-measuring { | ||
height: auto !important; | ||
overflow: hidden !important; | ||
padding: 2px 0 !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain the origin of the 2px
padding?
src/cdk/text-field/autosize.ts
Outdated
textarea.style.overflow = ''; | ||
// We subtract 4 from the scrollHeight because of the 2px top and bottom padding. Having the | ||
// extra 2px on either side seems to fix inaccurate measurements in Chrome. | ||
textarea.style.height = `${textarea.scrollHeight - 4}px`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phrase something like... "The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom)."
src/lib/input/input.scss
Outdated
@@ -92,3 +92,8 @@ textarea.mat-input-element { | |||
resize: none; | |||
} | |||
} | |||
|
|||
textarea.mat-input-element { | |||
padding: 2px 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment here explaining this as well?
comments addressed PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Not sure if Travis failure is a flake or a real issue |
Looks like a flake, re-ran it and it went away |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
fixes #10376