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
Auto-resize changes pageOffsetY in Chrome when textarea is near bottom of window #5699
Comments
I just found an issue with the collapse component in Chrome as well, that has to do with the window scrolling. https://bootstrap-vue.org/docs/components/collapse#accordion-support This does not happen if you open a collapse above the currently opened collapse, or simply open/close the same collapse. |
Wow, that's interesting! I think it might be related to the focus somehow. At least, the behavior doesn't occur when I trigger clicks via JS: There might be other significant differences between clicking via mouse or via code, but this makes the most sense to me: the element which is in focus stays put while everything else moves. It actually kind of makes sense: the focussed element is probably most important to the user right now, so it probably shouldn't move around (or even off) the screen. Btw: I checked and clicking on the buttons does focus on them, while calling |
If the collapsing-issue actually is related to the focussed element being kept where it is, it would be a separate issue, though. I just checked the CodeSandbox and the container scrolls while the textarea is in focus, thus not keeping it where it is. I also have to say that I've encountered similar issues before (where the |
Yup, the focus seems to be the issue here. Running document.querySelectorAll('button.btn.btn-info.btn-block')
.forEach(button => button.addEventListener('focus', () => button.blur(), {passive: true})) in the console before clicking on the collapsibles fixes the issue for me. |
It might be a separate issue, but seemed oddly similar to your issue with the textarea. I'll continue to do some research. |
Looks like you were correct about it being a separate issue. |
I can't confirm this behavior on neither Chrome 84, Firefox or Safari on macOS. |
Is there anything for me to do to help you out with this? |
@LBBO The question is if it is just a Chrome 84 bug on Windows or if it is something we have to work around. |
Yep, the bug still exists in Chrome 85.0.4183.102 (Official Build, 64-bit, same device and OS as before). The new Chromium based Edge isn't installed on my machine yet and I'd rather keep it that way for easier testing, but I could set up a VM and test it there, if you'd like. |
@LBBO That would be awesome. The bug does not exist on Firefox and the "old" Edge? It would also be helpful for me if you could do a short screen-capture of reproducing the bug in the CodeSanbox and Chrome. |
Sure thing! I couldn't reproduce it on Firefox and I haven't tested the old Edge yet. The testing will take me a few days though since I'm running out of time for this weekend. As for the screen-capture: I added one to the issue I mentioned up top. Not a CodeSandbox, but it might help anyway. IIRC, |
@Hiws Yeah, that's exactly what the issue is. One consequence, for example, is that you can't edit the bottom lines of a text area when it's too close to the end of Thanks for taking care of the testing! If there's anything else I can do, just let me know |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Has anything happened in regard to this? If not, is there anything I can do to help? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
For anyone finding this, this is still relevant with Edge 99. Edit (25-01-2023): I worked around this issue by adding an observer that resizes a div wrapping the textarea based on the height inside. This does not pick up the auto height change that is being set shortly and therefor prevents the unexpected page scroll to be triggered. |
Describe the bug
When a
b-form-textarea
with more lines than it'srows
attribute is edited, it can cause the window to scroll upwards. To me, it looks like this happens because the textarea shrinks in height due toheight
being set toauto
in the on-change handler in form-textarea.js:176. If the window's bottom is now higher than the screen's bottom, the browser automatically scrools upwards to fill the empty space. Now, the textarea is reset in it's height, but the new scroll position is already set and doesn't change back.Please note that I have only observed this bug in Chrome and could not reproduce it in Firefox.
Steps to reproduce the bug
b-form-textarea
and fill it with so many lines, thatrows
<= # lines <=max-rows
. The textarea must overflow one of it's parents and cause a scroll bar.Expected behavior
The scrolling position should not change whenever editing a textarea, unless it is to display a new line that was added that would have otherwise been off-screen.
Versions
Libraries:
(See CodeSandbox below)
Environment:
Demo link
See this CodeSandbox. Make sure to follow the steps above to observe the issue.
Additional context
I came across this bug in vabene1111/recipes and opened an issue there already. That issue contains a GIF showing the behavior in the app that might be helpful in case my description wasn't understandable enough.
The text was updated successfully, but these errors were encountered: