Skip to content

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

Merged
merged 2 commits into from
May 1, 2018

Conversation

mmalerba
Copy link
Contributor

fixes #10376

@mmalerba mmalerba added pr: needs review target: patch This PR is targeted for the next patch release labels Apr 11, 2018
@mmalerba mmalerba requested a review from jelbourn April 11, 2018 22:50
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 11, 2018
@@ -19,6 +19,13 @@
textarea.cdk-textarea-autosize {
resize: none;
}

textarea.cdk-textarea-autosize-measuring {
height: auto !important;
Copy link
Member

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?

textarea.cdk-textarea-autosize-measuring {
height: auto !important;
overflow: hidden !important;
padding: 2px 0 !important;
Copy link
Member

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?

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`;
Copy link
Member

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)."

@@ -92,3 +92,8 @@ textarea.mat-input-element {
resize: none;
}
}

textarea.mat-input-element {
padding: 2px 0;
Copy link
Member

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?

@mmalerba
Copy link
Contributor Author

comments addressed PTAL

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 24, 2018
@jelbourn
Copy link
Member

Not sure if Travis failure is a flake or a real issue

@mmalerba
Copy link
Contributor Author

Looks like a flake, re-ran it and it went away

@andrewseguin andrewseguin added the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label Apr 26, 2018
@jelbourn jelbourn assigned mmalerba and unassigned jelbourn Apr 28, 2018
@mmalerba mmalerba removed the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label Apr 28, 2018
@josephperrott josephperrott merged commit 385f96d into angular:master May 1, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Textarea with matTextareaAutosize has spinner arrows
5 participants