-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix inconsistent auto-scroll behavior in Actions log viewer #34957
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
base: main
Are you sure you want to change the base?
Conversation
- Resolves auto-scroll becoming unreliable after manual scrolling - Improves auto-scroll reliability when following logs of running actions - Added comprehensive unit tests covering auto-scroll scenarios Eliminates the need for repeated manual intervention to re-enable auto-scroll when following long-running actions.
Written by AI? I can see duplicate code and the tests are not easy to read.
Can you show a screenshot (picture or video) to elaborate the problem? |
With a lot of help from AI, yep. The tests are not easy to read because the Vue code is very difficult to test (there weren't any for this view previously). We could just continue that trend and I can delete the tests ... I'll see if I can record a quick video - the behavior isn't subtle, though - the auto scroll just basically doesn't work for more than a few log updates, at least from my experience. I've checked Safari and Chrome both, no difference. |
I can understand this part.
I can understand this part, but I think we can simplify the code. Ideally, we only need to check "if the last element's bottom (the last group's bottom) is in the viewport", no need to use recursive traversal to find the "last line".
understand
Do we really need the animation and use "requestAnimationFrame"?
Don't quite understand |
Some more thoughts: can we only maintain a "autoscroll-able" flag and avoid more "if" checks? The brief idea is:
|
I'll see what I can do with your ideas, thanks for the feedback! The "status-aware scrolling" is more of a side-effect fix of the other parts - I was noticing while testing that if an earlier group was expanded and completed, with no subsequent groups expanded, the logic kept scrolling me back to the last line of the previous group when I was trying to get to a subsequent group to expand it. So, that was the simplest approach I could think of - don't scroll to the bottom of a group that's already completed. |
Reviewed the "Root Causes" (again):
We can relax the check (as implemented in this PR, relax about 10%), and check the last item's bottom line. Maybe we can have a separate function and have a simple test for it, then no need these vue mock tricks.
Although I proposed to handle "scroll" event, after I asked GitHub Copilot, it says that it's almost impossible to correctly distinguish the "scroll" events triggered by scrollIntoView or user's input. So maybe we should use |
Problem
Auto-scroll in the Actions log viewer becomes unreliable after manual scrolling, requiring repeated manual intervention to re-enable auto-scroll when following long-running actions.
Root Cause
The original auto-scroll logic had several issues:
Solution
requestAnimationFrame
, throttling, andscrollIntoView
withbehavior: 'instant'
Testing
Files Changed
web_src/js/components/RepoActionView.vue
- Enhanced auto-scroll logic and viewport detectionweb_src/js/components/RepoActionView.test.ts
- Added behavioral tests for auto-scroll scenarios