diff --git a/src/frontend/js/classes/table-of-content.js b/src/frontend/js/classes/table-of-content.js index 682bad1..86a879c 100644 --- a/src/frontend/js/classes/table-of-content.js +++ b/src/frontend/js/classes/table-of-content.js @@ -288,6 +288,18 @@ export default class TableOfContent { * @returns {void} */ scrollToActiveItemIfNeeded() { + /** + * Do nothing if the Table of Content has no internal scroll at this page + * + * @todo compute it once + */ + const hasScroll = this.nodes.wrapper.scrollHeight > this.nodes.wrapper.clientHeight; + + if (!hasScroll) { + return; + } + + /** * If some item is highlighted, check whether we need to scroll to it or not */