From baf410a364a91a69fec328a1e1f0c2c5f34aa3a3 Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Fri, 5 Apr 2019 09:56:31 -0700 Subject: [PATCH] Retain scrolltop on resize (#2358) --- src/plugins/telemetryTable/components/table.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/telemetryTable/components/table.vue b/src/plugins/telemetryTable/components/table.vue index dde114b225..595f8492fe 100644 --- a/src/plugins/telemetryTable/components/table.vue +++ b/src/plugins/telemetryTable/components/table.vue @@ -588,13 +588,18 @@ export default { let el = this.$el; let width = el.clientWidth; let height = el.clientHeight; + let scrollTop = this.scrollable.scrollTop; this.resizePollHandle = setInterval(() => { if ((el.clientWidth !== width || el.clientHeight !== height) && this.isAutosizeEnabled) { this.calculateTableSize(); + // On some resize events scrollTop is reset to 0. Possibly due to a transition we're using? + // Need to preserve scroll position in this case. + this.scrollable.scrollTop = scrollTop; width = el.clientWidth; height = el.clientHeight; } + scrollTop = this.scrollable.scrollTop; }, RESIZE_POLL_INTERVAL); },