From 7291cac834862d9882357ae5b183b3ac8e0e8975 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 17 Aug 2020 17:58:39 +0200 Subject: [PATCH] yield for browser to render before checking content height --- src/ui/web/session/room/TimelineList.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/web/session/room/TimelineList.js b/src/ui/web/session/room/TimelineList.js index d350c708..8838963c 100644 --- a/src/ui/web/session/room/TimelineList.js +++ b/src/ui/web/session/room/TimelineList.js @@ -92,9 +92,12 @@ export class TimelineList extends ListView { super.unmount(); } - loadList() { + async loadList() { super.loadList(); const root = this.root(); + // yield so the browser can render the list + // and we can measure the content below + await Promise.resolve(); const {scrollHeight, clientHeight} = root; if (scrollHeight > clientHeight) { root.scrollTop = root.scrollHeight;