Fix type box losing focus when switching IMEs (#2390)
This commit is contained in:
parent
ec15f1176c
commit
09a946574b
@ -249,6 +249,11 @@ const dummyButton = document.createElement("button");
|
|||||||
dummyButton.style.position = "absolute";
|
dummyButton.style.position = "absolute";
|
||||||
dummyButton.style.left = "-9999px";
|
dummyButton.style.left = "-9999px";
|
||||||
document.addEventListener("focusout", (event) => {
|
document.addEventListener("focusout", (event) => {
|
||||||
|
// Prevent type box from losing focus when switching IMEs
|
||||||
|
if (!document.hasFocus()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
|
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
|
||||||
document.body.appendChild(dummyButton);
|
document.body.appendChild(dummyButton);
|
||||||
|
Loading…
Reference in New Issue
Block a user