Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type box losing focus when switching IMEs #2390

Merged
merged 1 commit into from Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions ts/reviewer/index.ts
Expand Up @@ -249,6 +249,11 @@ const dummyButton = document.createElement("button");
dummyButton.style.position = "absolute";
dummyButton.style.left = "-9999px";
document.addEventListener("focusout", (event) => {
// Prevent type box from losing focus when switching IMEs
if (!document.hasFocus()) {
return;
}

const target = event.target;
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
document.body.appendChild(dummyButton);
Expand Down