From 4a6bc2482a26aa0441485ca360a3d3c0eeea7fe4 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 17 Aug 2018 13:39:06 +0200 Subject: [Glitch] Defer scrollIntoView after DOM is drawn --- app/javascript/flavours/glitch/features/status/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/javascript/flavours/glitch/features/status/index.js b/app/javascript/flavours/glitch/features/status/index.js index e1330b183..ddc2f820a 100644 --- a/app/javascript/flavours/glitch/features/status/index.js +++ b/app/javascript/flavours/glitch/features/status/index.js @@ -327,10 +327,10 @@ export default class Status extends ImmutablePureComponent { if (status && ancestorsIds && ancestorsIds.size > 0) { const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1]; - if (element) { + window.requestAnimationFrame(() => { element.scrollIntoView(true); - this._scrolledIntoView = true; - } + }); + this._scrolledIntoView = true; } } -- cgit