Closed JayAhn2 closed 4 months ago
The actual behavior is the native expected behavior, try removing the scrollbar and use overflow: auto
on a div instead, you will get the same behavior.
You are right. It happens not only with ngx-scrollbar but also with overflow: auto
.
I think it is not quite desirable behavior as normally scrollbar isn't moved to anywhere as far as text cursor is positioned within the scrolled view...
If you don't mind, do you have any idea to avoid this issue?
Many thanks!
@MurhafSousli Seems I found the bug issue related to cdkTextareaAutosize
https://github.com/angular/components/issues/23834
Thanks!
Reproduction
Use StackBlitz to reproduce the issue: https://stackblitz.com/edit/6x7kqx
Open this StackBlitz project.
Write a long text into the textarea that exceeds 300px in height, causing the vertical scrollbar in the ng-scrollbar tag to appear.
Scroll to the middle of the text and try to type something in the middle of the textarea.
Move to scroll to the middle
Type somthing
Expected Behavior
When typing in the middle of the textarea, the vertical scrollbar should remain in its current position unless the text cursor (caret) is moved out of the visible area.
Actual Behavior
When typing in the middle of the textarea, the vertical scrollbar automatically moves to the top, causing the text view to jump unexpectedly. This behavior disrupts the user experience as the scrollbar should not move as long as the text cursor is within the visible area.
Environment