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
[Tabs] Textarea values not shown in hidden tabs #5222
P2The issue is important to a large percentage of users, with a workaroundarea: material/tabshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix
The value of text area with mdTextareaAutosize is not visible until the size of the text area is recalculated (with resizeToFitContent() or by typing) when the text area is inside an MdTab that is not initially visible.
The min rows is also not working.
What is the expected behavior?
The text area value is visible and min rows works.
What is the current behavior?
The text area value is not visible until the value change by typing or resizeToFitContent is called and min rows doesn't works.
The size of the textarea is calculated on init of the component and the component is not actually injected into the dom until the user clicks the tab.
Another approach for resolution would be to use the intersection observer to detect when the textarea is in view and then calculate the size. Reference: https://github.com/w3c/IntersectionObserver/blob/gh-pages/explainer.md ... this might be nice CDK directive to have for other situations too.
IntersectionObserver is a long way away from being usable on the platforms we support.
This is mostly the same as #3346. I don't have any greats ideas for a good way for the autosize to know when it should "go" based on being hidden or not in the DOM. @crisbeto@andrewseguin any thoughts?
In this case it might be best not to try and handle it automatically, or we risk destroying performance. Instead consumers can get a hold of the MdTextareaAutosize instance and call resizeToFitContent manually when appropriate. Note that we'll probably have to tweak resizeToFitContent since it won't do anything if the value hasn't changed.
I'd like to be able to get hold of the MdTextareaAutosize instance in order to call resizeToFitContent when appropriate, but I cannot seem to find out how to get a reference to it...
changed the title [-]Value of text area with mdTextareaAutosize is not visible inside MdTab[/-][+][Tabs] Textarea values not shown in hidden tabs[/+]on Oct 19, 2017
P2The issue is important to a large percentage of users, with a workaroundarea: material/tabshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix
Activity
ybeauchamph commentedon Jul 26, 2017
Related to #3346.
amcdnl commentedon Aug 23, 2017
@jelbourn - This is likely related to #1854.
The size of the textarea is calculated on init of the component and the component is not actually injected into the dom until the user clicks the tab.
Another approach for resolution would be to use the intersection observer to detect when the textarea is in view and then calculate the size. Reference: https://github.com/w3c/IntersectionObserver/blob/gh-pages/explainer.md ... this might be nice CDK directive to have for other situations too.
jelbourn commentedon Aug 30, 2017
IntersectionObserveris a long way away from being usable on the platforms we support.This is mostly the same as #3346. I don't have any greats ideas for a good way for the
autosizeto know when it should "go" based on being hidden or not in the DOM. @crisbeto @andrewseguin any thoughts?crisbeto commentedon Aug 30, 2017
In this case it might be best not to try and handle it automatically, or we risk destroying performance. Instead consumers can get a hold of the
MdTextareaAutosizeinstance and callresizeToFitContentmanually when appropriate. Note that we'll probably have to tweakresizeToFitContentsince it won't do anything if the value hasn't changed.jelbourn commentedon Aug 30, 2017
We could do something like setting the previous value to
''if the height is zeroMatthewTrout commentedon Sep 8, 2017
I'd like to be able to get hold of the
MdTextareaAutosizeinstance in order to callresizeToFitContentwhen appropriate, but I cannot seem to find out how to get a reference to it...ybeauchamph commentedon Sep 8, 2017
@MatthewTrout You can use the ViewChildren decorator.
In your class properties:
@ViewChildren(MdTextareaAutosize) textareaAutosizes: QueryList<MdTextareaAutosize>;Then you can use it in AfterViewInit:
this.textareaAutosizes.forEach(autosize => autosize.resizeToFitContent());amcdnl commentedon Sep 9, 2017
@MatthewTrout - You will be able to use the lazy loaded tab feature when it comes out and that should fix this issue.
myrddraall commentedon Sep 22, 2017
@Zihark17 this doesn't work due to:
at the top of the
resizeToFitContentfunctionthis works but its a nasty workaround:
[-]Value of text area with mdTextareaAutosize is not visible inside MdTab[/-][+][Tabs] Textarea values not shown in hidden tabs[/+]