From 4601a58ac24f2c97ba4934445da694ca18308b81 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 17 Aug 2018 14:07:38 +0200 Subject: [PATCH] Defer scrollIntoView after DOM is drawn (fixes #8239) (#8242) --- app/javascript/mastodon/features/status/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 89387ca434..0ffeaa4dc1 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -355,7 +355,9 @@ export default class Status extends ImmutablePureComponent { if (status && ancestorsIds && ancestorsIds.size > 0) { const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1]; - element.scrollIntoView(true); + window.requestAnimationFrame(() => { + element.scrollIntoView(true); + }); this._scrolledIntoView = true; } }