[openstreetmap/openstreetmap-website] Fix keyboard navigation for richtext field tabs in New Diary Entry (PR #6691)

Holger Jeromin notifications at github.com
Fri Jan 9 09:30:47 UTC 2026


@HolgerJeromin commented on this pull request.



> @@ -12,6 +12,42 @@
     preview.children(".richtext").empty();
   });
 
+  /*
+   * Block arrow keys on richtext tabs to prevent Bootstrap's buggy keyboard navigation.
+   * Uses capture phase to intercept before Bootstrap handles the event.
+   */
+  document.addEventListener("keydown", function (e) {
+    if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(e.key)) return;
+    if (!e.target.matches?.(".richtext_container button[data-bs-toggle='tab']")) return;
+
+    e.preventDefault();
+    e.stopPropagation();
+    e.stopImmediatePropagation();
+  }, true);

Make this more clear:
```suggestion
  }, {capture: true});
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6691#pullrequestreview-3643109413
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6691/review/3643109413 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260109/2ad603c4/attachment.htm>


More information about the rails-dev mailing list