mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix missing buttons on bottom bar when window is narrow (#3653)
* Delay offsetHeight query to account for reflow * Handle invalid value if webview page was deleted
This commit is contained in:
parent
3a7a1c7346
commit
53a2e34a3f
1 changed files with 12 additions and 2 deletions
|
@ -246,8 +246,18 @@ class BottomWebView(ToolbarWebView):
|
||||||
|
|
||||||
self.hidden = False
|
self.hidden = False
|
||||||
if self.mw.state == "review":
|
if self.mw.state == "review":
|
||||||
self.evalWithCallback(
|
# delay to account for reflow
|
||||||
"document.documentElement.offsetHeight", self.animate_height
|
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:
|
else:
|
||||||
self.adjustHeightToFit()
|
self.adjustHeightToFit()
|
||||||
|
|
Loading…
Reference in a new issue