From 10e5e0c841664ca8469586640b6ea118aaeaac8e Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 6 Apr 2024 09:50:04 +0200 Subject: [PATCH] restore keyboard post navigation --- files/assets/js/post_navigation.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/assets/js/post_navigation.js b/files/assets/js/post_navigation.js index 7dbab00d4..182d85036 100644 --- a/files/assets/js/post_navigation.js +++ b/files/assets/js/post_navigation.js @@ -18,6 +18,16 @@ if (post_permalinks) { btn.classList.remove('d-none') btn.href = permalink_after.slice(1, -1) } + + document.addEventListener('keydown', (e) => { + if ( + ["d", "ArrowRight"].includes(e.key) && + !["TEXTAREA", "INPUT"].includes(document.activeElement.tagName) && + !(e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) + ) { + location.href = permalink_after.slice(1, -1) + } + }) } } }