Delaying horizontal scrolling

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2020-11-05 19:36:03 +03:00
1 parent 4caddf5046
commit 871173e5ca
1 file changed
+6 -4
+6 -4
View File
@@ -118,10 +118,12 @@ export class PodLogs extends React.Component<Props> {
if (!this.virtualListRef.current || activeOverlayLine === undefined) return; if (!this.virtualListRef.current || activeOverlayLine === undefined) return;
// Scroll vertically // Scroll vertically
this.virtualListRef.current.scrollToItem(activeOverlayLine, "center"); this.virtualListRef.current.scrollToItem(activeOverlayLine, "center");
// Scroll horizontally // Scroll horizontally in timeout since virtual list need some time to prepare its contents
const overlay = document.querySelector(".PodLogs .list span.active"); setTimeout(() => {
if (!overlay) return; const overlay = document.querySelector(".PodLogs .list span.active");
overlay.scrollIntoViewIfNeeded(); if (!overlay) return;
overlay.scrollIntoViewIfNeeded();
}, 100);
} }
/** /**