]> git.scottworley.com Git - vopamoi/commitdiff
moveCursor returns whether it was able to or not
authorScott Worley <scottworley@scottworley.com>
Wed, 26 Jan 2022 06:35:52 +0000 (22:35 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:09 +0000 (12:21 -0800)
vopamoi.ts

index 4e69d0f666ea4eb1992cfb0befce1034c16e3095..bc7acb79604733e42bc570409f62fa6a54fd874d 100644 (file)
@@ -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;
   },
 };