X-Git-Url: https://git.jacobcasper.com/?p=hnim.git;a=blobdiff_plain;f=hnim.js;h=aab3bc05c913bf797933639202210d15f2e95db9;hp=ab854f8e0964bc8cecf5cc017333a76e1ba8caf3;hb=91f9300708138dfc9a540f39e972306ff2ba2042;hpb=b0699b831a3228986a8812d8143ee4bb0813099a diff --git a/hnim.js b/hnim.js index ab854f8..aab3bc0 100644 --- a/hnim.js +++ b/hnim.js @@ -15,7 +15,7 @@ const visible = (element) => { let bounds = element.getBoundingClientRect(); - return bounds.top >= 0 && bounds.bottom <= window.innerHeight; + return Math.abs(bounds.bottom - bounds.top) > window.innerHeight || bounds.top >= 0 && bounds.bottom <= window.innerHeight; } const changeWithVisibleCallback = (comment, callback) => { @@ -51,7 +51,7 @@ change(e.target.closest("tr.athing")); }) document.addEventListener("keydown", (e) => { - if (e.isComposing) { + if (e.target.type === 'textarea' || e.isComposing) { return; } switch (e.key) {