From 09a8893947d059d5b5d7755306a56cceb62783b6 Mon Sep 17 00:00:00 2001 From: Steve Goodwin Date: Mon, 30 Mar 2026 14:16:50 -0400 Subject: [PATCH] Prevent pod log search from shifting page layout --- .../public/components/utils/resource-log.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/public/components/utils/resource-log.tsx b/frontend/public/components/utils/resource-log.tsx index e149391a808..ca03e394ba3 100644 --- a/frontend/public/components/utils/resource-log.tsx +++ b/frontend/public/components/utils/resource-log.tsx @@ -808,6 +808,24 @@ export const ResourceLog: FC = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [firstRender, error, stale, hasTruncated, isFullscreen]); + // 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 + useEffect(() => { + 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]); + return (