Skip to content

matTextareaAutosize does not get updated on window resize #8610

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

Closed
qstiegler opened this issue Nov 23, 2017 · 3 comments · Fixed by #8619
Closed

matTextareaAutosize does not get updated on window resize #8610

qstiegler opened this issue Nov 23, 2017 · 3 comments · Fixed by #8619
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@qstiegler
Copy link

Bug, feature request, or proposal:

matTextareaAutosize does not update the length when window dimensions are changing. The textarea then is either not displaying the whole content or is higher then the required lines for the content.

What is the expected behavior?

It should resize when changing the dimensions of the window.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.0.0
Material 5.0.0-rc.1
TypeScript 2.4.2
Chrome 62

@crisbeto crisbeto self-assigned this Nov 23, 2017
@crisbeto crisbeto added has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Nov 23, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 23, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes angular#8610.
@qstiegler
Copy link
Author

I had an additional issue with the matTextareaAutosize directive. I´m now already using this fix for the resizing issue, but the initial size calculation is not working in my case.

Even if the initial trigger in the directive gets called in the ngAfterViewInit method, I needed to replace the initial call of the this.resizeToFitContent() in src/lib/input/autosize.ts:92 by setTimeout(() => this.resizeToFitContent(true), 0); otherwise my content was not ready. Do you have an idea to optimize that?

@qstiegler
Copy link
Author

Update: I do not longer need the setTimout around the anymore but I need the force flag at this call src/lib/input/autosize.ts:92. Otherwise sometimes the initial height calculation is wrong and it gets updated after the first value change or window resize event.

mmalerba pushed a commit that referenced this issue Dec 8, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes #8610.
mmalerba pushed a commit that referenced this issue Dec 8, 2017
Fixes the autosize textarea not recalculating its height when the viewport size has changed.

Fixes #8610.
@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants