diff --git a/qt/aqt/toolbar.py b/qt/aqt/toolbar.py index 2ae8e6d72..56fcb206e 100644 --- a/qt/aqt/toolbar.py +++ b/qt/aqt/toolbar.py @@ -246,8 +246,18 @@ class BottomWebView(ToolbarWebView): self.hidden = False if self.mw.state == "review": - self.evalWithCallback( - "document.documentElement.offsetHeight", self.animate_height + # delay to account for reflow + def cb(height: int | None): + # "When QWebEnginePage is deleted, the callback is triggered with an invalid value" + if height is not None: + self.animate_height(height) + + self.mw.progress.single_shot( + 50, + lambda: self.evalWithCallback( + "document.documentElement.offsetHeight", cb + ), + False, ) else: self.adjustHeightToFit()