Skip to content

fix: prevent log loading from scrolling ancestor elements in task Logs tab#64889

Open
Pyasma wants to merge 1 commit intoapache:v2-11-testfrom
Pyasma:fix/ui-logs-scroll-glitch
Open

fix: prevent log loading from scrolling ancestor elements in task Logs tab#64889
Pyasma wants to merge 1 commit intoapache:v2-11-testfrom
Pyasma:fix/ui-logs-scroll-glitch

Conversation

@Pyasma
Copy link
Copy Markdown
Contributor

@Pyasma Pyasma commented Apr 8, 2026

Closes: #64757

Problem

When switching to the Logs tab on a task with many log lines, the entire details panel scrolls irreversibly instead of just the log box.

Root cause: scrollToBottom() called scrollIntoView() on a sentinel <div> at the bottom of log content. scrollIntoView walks up the DOM tree scrolling every ancestor element until the target is visible — so div.c-5s5pdh (the details panel) was being scrolled, not just the log box.

Fix

LogBlock.tsx

- const codeBlockBottomDiv = useRef<HTMLDivElement>(null);

  const scrollToBottom = () => {
-   codeBlockBottomDiv.current?.scrollIntoView({
-     block: "nearest",
-     inline: "nearest",
-   });
+   if (logBoxRef.current) {
+     logBoxRef.current.scrollTop = logBoxRef.current.scrollHeight;
+   }
  };
  <div dangerouslySetInnerHTML={{ __html: parsedLogs }} />
- <div ref={codeBlockBottomDiv} />

scrollTop = scrollHeight sets the scroll position directly on the log box element only. Nothing outside it moves.

useOffsetTop.ts

- const useOffsetTop = (contentRef: React.RefObject<HTMLElement>) => {
+ const useOffsetTop = (contentRef: React.RefObject<HTMLElement | null>) => {

Updated parameter type to accept null inside the generic — required because useRef<HTMLElement>(null) now returns RefObject<HTMLElement | null> in newer React/TypeScript versions.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (claude-sonnet-4-6) following the guidelines

@Pyasma Pyasma marked this pull request as draft April 8, 2026 08:56
@Pyasma Pyasma changed the title removing scroll into view to scroll to Bottom fix: prevent log loading from scrolling ancestor elements in task Logs tab Apr 8, 2026
@Pyasma Pyasma marked this pull request as ready for review April 8, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant