소스 검색

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
Alexis Degrugillier 5 년 전
부모
커밋
d6a0af6ba0
1개의 변경된 파일과 1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      p/scripts/main.js

+ 1 - 1
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;