Skip to content

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

Closed
Pyasma wants to merge 2 commits intoapache:v2-11-testfrom
Pyasma:fix/ui-logs-scroll-glitch-v3
Closed

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

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 instance with many log lines, scrollIntoView() was called on a sentinel <div> at the bottom of the log content. This API walks up the DOM tree and scrolls every scrollable ancestor until the target is visible — causing the details panel (and page) to scroll irreversibly, not just the log box itself.

Fix

Replace scrollIntoView() with a direct scrollTop = scrollHeight assignment on the log box element (logBoxRef). This only scrolls the log box itself, leaving all ancestor elements untouched.

Also updated useOffsetTop to accept RefObject<HTMLElement | null> to align with the stricter ref types in newer React/TypeScript versions.

Changes

  • airflow/www/static/js/dag/details/taskInstance/Logs/LogBlock.tsx — replaced scrollIntoView with direct scrollTop scroll; removed unused sentinel <div>
  • airflow/www/static/js/utils/useOffsetTop.ts — updated parameter type to RefObject<HTMLElement | null>

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

@Pyasma
Copy link
Copy Markdown
Contributor Author

Pyasma commented Apr 8, 2026

Closing in favour of #64889 which has a cleaner diff (no unrelated file).

@Pyasma Pyasma closed this Apr 8, 2026
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