Fix reviewer shortcuts being inaccessible due to IME

Only tested on Windows, but hopefully resolves the Linux issue as well.

Closes #1952
This commit is contained in:
Damien Elmes 2022-09-17 14:15:07 +10:00
parent 39d59caa48
commit 5bf031f1e3
2 changed files with 8 additions and 3 deletions

View file

@ -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
##########################################################################

View file

@ -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()