You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MdTextareaAutosize: value not rendered with display:none style at initialization of component #3346
Bug: When the resizing functionality is used on a textarea within an element whose style contains 'display:none' at initialization the value of the textarea is not rendered to the user. When a user enters the field and begins to provide input the existing data value is then rendered in full.
What is the expected behavior?
Pre-populated data values are displayed to the user when the component becomes visible even if the wrapping container is set to 'display:none' at initialization.
What is the current behavior?
When the container is toggled visible to the user the data value is not displayed. The height of the component appears to be set to 0px by MdTextareaAutosize. Once a user begins to enter more data it triggers another resize and the field populates with the data and resizes.
This example has two wrapper 'div' elements whose display property is manipulated by a button. One is set to 'display:none' at load and demonstrates the problem of data not being visible when you toggle the 'div' that contains the textarea to be visible.
The second 'div' just demonstrates that the data is present on load as expected when the wrapping 'div' does not have 'display:none' set.
What is the use-case or motivation for changing an existing behavior?
Support pre-populated data in components which require resize on load but may not be visible to users at initialization.
Is there anything else we should know?
Material 1 did some state checking and had a watcher out there that resized when the component became visible based on criteria.
Activity
rscottfree commentedon Mar 6, 2017
Unsurprisingly, this also affects MdTextareaAutosize text areas inside of mdTabs.
While not ideal, a quick fix to overwrite the
height: 0could be:programmersharp commentedon Apr 27, 2017
I tried this solution but the problem is that when the initial value is multi line, then the default scroll bars appear for textarea.
gedclack commentedon Jun 5, 2017
+1👍This problem occurs especially when
mdTextareaAutosizeis present.jsitu commentedon Jul 18, 2017
@programmersharp I had the same issue regarding displaying the initial value which is multi-line, did you solve this issue?
programmersharp commentedon Jul 19, 2017
@jsitu no, I didn't
jsitu commentedon Jul 19, 2017
@programmersharp, I found a workaround for the issue:
I have it declared within the
ngOnInitlifecycle hook. Kind of hacky but it does the job.amcdnl commentedon Aug 23, 2017
One suggestion might be using
*ngIfrather thandisplay: none.jelbourn commentedon Apr 28, 2020
Closing this since I don't think there's a viable way for the directive to know about visibility changes like this.
angular-automatic-lock-bot commentedon May 29, 2020
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.