Hide onscreen keyboard by defocusing input on touch move

This commit is contained in:
Adrian Gruntkowski 2025-03-22 11:35:06 +01:00
parent d880130303
commit 03c1bc9931

View file

@ -118,6 +118,18 @@ class EditableArea extends HTMLElement {
this.#sync();
});
const onTouchMove = () => {
this.inputElement.blur();
};
this.inputElement.addEventListener("focus", () => {
document.addEventListener("touchmove", onTouchMove);
});
this.inputElement.addEventListener("blur", () => {
document.removeEventLitener("touchmove", onTouchMove);
});
new ResizeObserver(() => {
this.inputElement.style.height = this.displayElement.scrollHeight + "px";
this.inputElement.style.width = this.displayElement.scrollWidth + "px";