From: Scott Worley Date: Wed, 26 Jan 2022 06:35:52 +0000 (-0800) Subject: moveCursor returns whether it was able to or not X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/7523dc894af60222f05795a43dcae6ecee0b4daa?ds=inline;hp=4101e1b1dab33f7fcdfd4a26edab2e79b66716d6 moveCursor returns whether it was able to or not --- diff --git a/vopamoi.ts b/vopamoi.ts index 4e69d0f..bc7acb7 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -26,7 +26,7 @@ const Model = { document.body.appendChild(this.createTask(timestamp, description)).focus(); }, - moveCursor: function (offset: number) { + moveCursor: function (offset: number): boolean { var active = document.activeElement; if (offset === 1 && active) { active = active.nextElementSibling; @@ -34,7 +34,11 @@ const Model = { if (offset === -1 && active) { active = active.previousElementSibling; } - if (active && active instanceof HTMLElement) active.focus(); + if (active && active instanceof HTMLElement) { + active.focus(); + return true; + } + return false; }, };