From a73177515a438c947d6e6e7a7356dfe67991d740 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Wed, 11 Jun 2025 08:57:43 +0100 Subject: [PATCH] Docs: mobile layout fix (#2466) * Remove console warning * Fix table overflow issue on mobile --- docs/extra.css | 2 +- docs/theme_overrides/js/theme.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/extra.css b/docs/extra.css index ecd99f66..770508a6 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -59,7 +59,7 @@ h1, h2, h3, h4, h5, h6 { left: -3.236em; max-width: calc(100cqw); width: fit-content; - min-width: calc(100% + 3.236em + 3.236em); + min-width: min(calc(100% + 3.236em + 3.236em), 100cqw); } .rst-content .section .wy-table-responsive .docutils { padding-left: 3.236em; diff --git a/docs/theme_overrides/js/theme.js b/docs/theme_overrides/js/theme.js index f87c9f26..05689756 100644 --- a/docs/theme_overrides/js/theme.js +++ b/docs/theme_overrides/js/theme.js @@ -134,11 +134,13 @@ function ThemeNav () { // .wy-table-responsive activates css rules that change the size of // tables, making anchor points move around. console.log('Document ready, checking for anchor in URL'); - const anchorEl = document.querySelector(window.location.hash); - anchorEl.getBoundingClientRect(); // Force layout to ensure scrollIntoView works correctly - if (anchorEl) { - console.log('Anchor element:', anchorEl); - anchorEl.scrollIntoView({ behavior: 'instant', block: 'start' }); + if (window.location.hash) { + const anchorEl = document.querySelector(window.location.hash); + anchorEl.getBoundingClientRect(); // Force layout to ensure scrollIntoView works correctly + if (anchorEl) { + console.log('Anchor element:', anchorEl); + anchorEl.scrollIntoView({ behavior: 'instant', block: 'start' }); + } } // end edit by joerick };