Input: Make AutoGrow responsive to parameters & Fix empty line after scrollbar is hidden#8385
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8385 +/- ##
==========================================
+ Coverage 88.82% 88.89% +0.06%
==========================================
Files 407 407
Lines 12226 12226
Branches 2441 2441
==========================================
+ Hits 10860 10868 +8
+ Misses 834 829 -5
+ Partials 532 529 -3 ☔ View full report in Codecov by Sentry. |
|
For future, it's really bad to call JS like this #7155 |
Interesting, I'll take care of that, thanks! |
|
I guess it's too late for me, but what is the difference of this if (!oldAutoGrow && AutoGrow)
{
_shouldInitAutoGrow = true;
}
else if (oldAutoGrow && !AutoGrow)
{
_shouldInitAutoGrow = false;
await JsRuntime.InvokeVoidAsyncWithErrorHandling("mudInputAutoGrow.destroy", ElementReference);
}
if (firstRender || _shouldInitAutoGrow)
{
_shouldInitAutoGrow = false;
await JsRuntime.InvokeVoidAsyncWithErrorHandling("mudInputAutoGrow.initAutoGrow", ElementReference, MaxLines);
_oldText = _internalText;
}Compared to what it was without the |
|
I'm asking because we'd be able to use |
|
@ScarletKuro firstRender isn't enough because it also needs to update when the parameter changes so you can perform bindings. but if it hasn't been rendered yet it needs to defer to the firstRender. enables this: Video2.mp4 |
We have found a use-case for the oldValue/newValue event args sooner than I'd have expected. Good that the ParameterState framework supports them now! |
|
Thanks Daniel |
…scrollbar is hidden (MudBlazor#8385) * Input: Responsive to parameters & Dispose events * Ensure JS runtime is available
Description
Input is now responsive to:
In respect to auto-growing.
You can turn AutoGrow off and on or change the MaxLines etc.
The events subscribed by AutoGrow will be unsubscribed on dispose or when AutoGrow is disabled.
In addition, an empty line that would appear when the scrollbar is hidden has been taken care of by forcing a reflow.
How Has This Been Tested?
visually
Types of changes
In this video you can see how responsive it is now and how the event listeners are properly removed.
Video2.mp4
This was not possible and now is:
Video2.mp4
Then we have the empty line issue:
Video2.mp4
Video3.mp4
Which now looks like
Video4.mp4
We could go even further and test if the scrollbar can be removed so it reflows one line earlier (7 instead of 8 in the last video) but I'll save that for another time.
Checklist:
dev).