Skip to content

OCPBUGS-74156: Prevent pod log search from shifting page layout#16223

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
sg00dwin:OCPBUGS-74156-second-fix
Apr 3, 2026
Merged

OCPBUGS-74156: Prevent pod log search from shifting page layout#16223
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
sg00dwin:OCPBUGS-74156-second-fix

Conversation

@sg00dwin
Copy link
Copy Markdown
Member

@sg00dwin sg00dwin commented Mar 30, 2026

Bug

When viewing pod logs with "Wrap lines" disabled, searching for a string causes the entire page content to shift left, partially hidden behind the sidebar navigation.

The original fix #16193, using css only, introduced another bug on the Pods List, so it will be reverted with #16218

Root Cause

Upstream PatternFly bug (react-log-viewer#106). PF LogViewer calls scrollIntoView({ inline: 'center' }) on search matches, which per the CSSOM View spec scrolls all scrollable ancestors. PF Drawer sets overflow: hidden on .pf-v6-c-drawer__main, which still acts as a scroll container for programmatic scrolling, causing the entire page to shift.

Fix

A css-only fix is not available, so this adds a scroll event listener in ResourceLog that resets scrollLeft to 0 on .pf-v6-c-drawer__main, preventing the page shift. CSS-only approaches were investigated but ruled out.

Assisted by Claude code

After
log-viewer-after

Summary by CodeRabbit

  • Bug Fixes
    • Fixed scroll position behavior in the resource log drawer when displayed in fullscreen mode.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Mar 30, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sg00dwin: This pull request references Jira Issue OCPBUGS-74156, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Bug

When viewing pod logs with "Wrap lines" disabled, searching for a string causes the entire page content to shift left, partially hidden behind the sidebar navigation.

The original fix #16193, using css only, introduced another bug on the Pods List, so it will be reverted with #16218

Root Cause

Upstream PatternFly bug (react-log-viewer#106). PF LogViewer calls scrollIntoView({ inline: 'center' }) on search matches, which per the CSSOM View spec scrolls all scrollable ancestors. PF Drawer sets overflow: hidden on .pf-v6-c-drawer__main, which still acts as a scroll container for programmatic scrolling, causing the entire page to shift.

Fix

A css-only fix is not available, so this adds a scroll event listener in ResourceLog that resets scrollLeft to 0 on .pf-v6-c-drawer__main, preventing the page shift. CSS-only approaches were investigated but ruled out:

  • overflow: clip on .pf-v6-c-drawer__main fixes the shift but breaks vertical scrolling on other pages (e.g., pod list)
  • overflow-x: clip is silently converted to hidden per CSS spec when the other axis isn't clip
  • overflow: clip on the LogViewer wrapper doesn't block scrollIntoView propagation to higher ancestors

Assisted by Claude code

After
log-viewer-after

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from Leo6Leo, cajieh and yapei March 30, 2026 19:23
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Mar 30, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sg00dwin: This pull request references Jira Issue OCPBUGS-74156, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

Details

In response to this:

Bug

When viewing pod logs with "Wrap lines" disabled, searching for a string causes the entire page content to shift left, partially hidden behind the sidebar navigation.

The original fix #16193, using css only, introduced another bug on the Pods List, so it will be reverted with #16218

Root Cause

Upstream PatternFly bug (react-log-viewer#106). PF LogViewer calls scrollIntoView({ inline: 'center' }) on search matches, which per the CSSOM View spec scrolls all scrollable ancestors. PF Drawer sets overflow: hidden on .pf-v6-c-drawer__main, which still acts as a scroll container for programmatic scrolling, causing the entire page to shift.

Fix

A css-only fix is not available, so this adds a scroll event listener in ResourceLog that resets scrollLeft to 0 on .pf-v6-c-drawer__main, preventing the page shift. CSS-only approaches were investigated but ruled out:

  • overflow: clip on .pf-v6-c-drawer__main fixes the shift but breaks vertical scrolling on other pages (e.g., pod list)
  • overflow-x: clip is silently converted to hidden per CSS spec when the other axis isn't clip
  • overflow: clip on the LogViewer wrapper doesn't block scrollIntoView propagation to higher ancestors

Assisted by Claude code

After
log-viewer-after

Summary by CodeRabbit

  • Bug Fixes
  • Fixed scroll position behavior in the resource log drawer when displayed in fullscreen mode.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

A useEffect hook has been added to the ResourceLog component that attaches a scroll event listener to the .pf-v6-c-drawer__main ancestor when fullscreenRef is present. The listener forcibly resets the drawer's scrollLeft property to 0 on each scroll event to maintain horizontal scroll position. The effect properly handles cleanup of the event listener on unmount and dependency changes, with lifecycle tied to the fullscreenRef reference.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
frontend/public/components/utils/resource-log.tsx (1)

815-827: Scope the scroll-reset listener to nowrap mode only

This listener is currently active for all log-view states. Since the bug occurs with wrap disabled, keep this effect gated by !wrapLinesCheckbox so we avoid unnecessary global scroll interception and event churn.

Proposed change
  useEffect(() => {
+   if (wrapLinesCheckbox) {
+     return;
+   }
    const drawerMain = fullscreenRef.current?.closest('.pf-v6-c-drawer__main');
    if (!drawerMain) {
      return;
    }
    const resetScroll = () => {
      if (drawerMain.scrollLeft !== 0) {
        drawerMain.scrollLeft = 0;
      }
    };
    drawerMain.addEventListener('scroll', resetScroll);
    return () => drawerMain.removeEventListener('scroll', resetScroll);
- }, [fullscreenRef]);
+ }, [fullscreenRef, wrapLinesCheckbox]);

As per coding guidelines, "**: -Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/public/components/utils/resource-log.tsx` around lines 815 - 827,
The scroll-reset effect (useEffect) currently attaches resetScroll to drawerMain
unconditionally; change it to run only when wrapLinesCheckbox is false by adding
wrapLinesCheckbox to the dependency array and early-return if wrapLinesCheckbox
is true; keep the existing resetScroll, add/remove listener logic tied to
drawerMain, and ensure cleanup still removes the listener when wrapLinesCheckbox
toggles or fullscreenRef changes (useEffect deps: [fullscreenRef,
wrapLinesCheckbox]).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/public/components/utils/resource-log.tsx`:
- Around line 815-827: The scroll-reset effect (useEffect) currently attaches
resetScroll to drawerMain unconditionally; change it to run only when
wrapLinesCheckbox is false by adding wrapLinesCheckbox to the dependency array
and early-return if wrapLinesCheckbox is true; keep the existing resetScroll,
add/remove listener logic tied to drawerMain, and ensure cleanup still removes
the listener when wrapLinesCheckbox toggles or fullscreenRef changes (useEffect
deps: [fullscreenRef, wrapLinesCheckbox]).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ff9fb777-115e-4195-9bf1-4e5e3216d78b

📥 Commits

Reviewing files that changed from the base of the PR and between 703563f and 09a8893.

📒 Files selected for processing (1)
  • frontend/public/components/utils/resource-log.tsx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/public/components/utils/resource-log.tsx

@Leo6Leo
Copy link
Copy Markdown
Contributor

Leo6Leo commented Mar 31, 2026

/retest-required

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 31, 2026

@sg00dwin: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@rhamilto
Copy link
Copy Markdown
Member

rhamilto commented Apr 2, 2026

/lgtm
/hold for #16218 to merge first

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Apr 2, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto, sg00dwin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2026
@rhamilto
Copy link
Copy Markdown
Member

rhamilto commented Apr 2, 2026

cc: @logonoff since #16108 is also changing resource-log.tsx.

Comment on lines +811 to +814
// Workaround for upstream PF LogViewer bug: scrollIntoView({ inline: 'center' }) propagates
// to all scrollable ancestors, shifting the page layout when searching with wrap lines disabled.
// Reset scrollLeft on .pf-v6-c-drawer__main to prevent the page shift.
// https://github.com/patternfly/react-log-viewer/issues/106
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we contribute this upstream if a backport isn't needed?

@sg00dwin sg00dwin added verified Signifies that the PR passed pre-merge verification criteria and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Apr 3, 2026
@openshift-merge-bot openshift-merge-bot bot merged commit e672e69 into openshift:main Apr 3, 2026
8 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sg00dwin: Jira Issue Verification Checks: Jira Issue OCPBUGS-74156
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-74156 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Bug

When viewing pod logs with "Wrap lines" disabled, searching for a string causes the entire page content to shift left, partially hidden behind the sidebar navigation.

The original fix #16193, using css only, introduced another bug on the Pods List, so it will be reverted with #16218

Root Cause

Upstream PatternFly bug (react-log-viewer#106). PF LogViewer calls scrollIntoView({ inline: 'center' }) on search matches, which per the CSSOM View spec scrolls all scrollable ancestors. PF Drawer sets overflow: hidden on .pf-v6-c-drawer__main, which still acts as a scroll container for programmatic scrolling, causing the entire page to shift.

Fix

A css-only fix is not available, so this adds a scroll event listener in ResourceLog that resets scrollLeft to 0 on .pf-v6-c-drawer__main, preventing the page shift. CSS-only approaches were investigated but ruled out.

Assisted by Claude code

After
log-viewer-after

Summary by CodeRabbit

  • Bug Fixes
  • Fixed scroll position behavior in the resource log drawer when displayed in fullscreen mode.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in accepted release 4.22.0-0.nightly-2026-04-04-113332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants