diff options
| author | 2021-06-01 03:36:26 -0400 | |
|---|---|---|
| committer | 2021-06-01 09:36:26 +0200 | |
| commit | d6a0af6ba085af3b12a428654467c12775b47877 (patch) | |
| tree | f5186b50674805e9e625854ba53a8d44b36fb7c1 /p/scripts | |
| parent | 4823e6df11dc27757f7d05a5e778044287747a24 (diff) | |
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
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 2 |
1 files changed, 1 insertions, 1 deletions
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; |
