Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions frontend/public/components/utils/resource-log.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,24 @@ export const ResourceLog: FC<ResourceLogProps> = ({
// 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
Comment on lines +811 to +814
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?

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 (
<div
className={css('co-resource-log', { 'co-fullscreen pf-v6-u-p-sm': isFullscreen })}
Expand Down