From d6a0af6ba085af3b12a428654467c12775b47877 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 1 Jun 2021 03:36:26 -0400 Subject: Fix navigation JS error (#3655) Before, the UP navigation button was generating an error when no article was selected. The process to navigate to the first element was using the position of the current element to compute the offset, thus generating said error. Now, if no article is selected, the first article is used as a fall-back. See #3654 --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 61a6d7239..5713f57f3 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1093,7 +1093,7 @@ function init_nav_entries() { return false; }; nav_entries.querySelector('.up').onclick = function (e) { - const active_item = document.querySelector('.flux.current'), + const active_item = (document.querySelector('.flux.current') || document.querySelector('.flux')), windowTop = document.scrollingElement.scrollTop, item_top = active_item.offsetParent.offsetTop + active_item.offsetTop; -- cgit v1.2.3