diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 4ad68a626..64af05c3d 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -653,6 +653,12 @@ class Reviewer: def _onTypedAnswer(self, val: None) -> None: self.typedAnswer = val or "" self._showAnswer() + self.unfocus_typing_box() + + def unfocus_typing_box(self) -> None: + # shifting focus to the bottom area works around a WebEngine/IME bug + # https://github.com/ankitects/anki/issues/1952 + self.bottom.web.setFocus() # Bottom bar ########################################################################## diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 57d9b33e1..6c651b413 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -293,9 +293,8 @@ class AnkiWebView(QWebEngineView): w.close() else: # in the main window, removes focus from type in area - parent = self.parent() - assert isinstance(parent, QWidget) - parent.setFocus() + if mw.state == "review": + mw.reviewer.unfocus_typing_box() break w = w.parent()