diff --git a/web/public/theme/venix/css/admin-home.css b/web/public/theme/venix/css/admin-home.css index f9b23a64..97517214 100644 --- a/web/public/theme/venix/css/admin-home.css +++ b/web/public/theme/venix/css/admin-home.css @@ -1,17 +1,10 @@ .admin-template-body { - --admin-viewport-height: 100vh; min-height: 100vh; min-height: 100dvh; padding-bottom: 0 !important; background: #f3f5f9; } -@supports (height: 100dvh) { - .admin-template-body { - --admin-viewport-height: 100dvh; - } -} - .admin-template#app-layout { min-height: 100vh; min-height: 100dvh; @@ -35,10 +28,9 @@ .admin-template .app-sidebar-menu { position: fixed; - inset: 0 auto auto 0; + inset: 0 auto 0 0; width: 260px; - height: 100vh; - height: var(--admin-viewport-height, 100dvh); + height: auto; padding-top: 0 !important; z-index: 1001 !important; background: #061836; @@ -2152,9 +2144,8 @@ body.billing-detail-open { .admin-template-body.admin-sidebar-open .admin-sidebar-backdrop { display: block; position: fixed; - inset: 0 0 auto; - height: 100vh; - height: var(--admin-viewport-height, 100dvh); + inset: 0; + height: auto; z-index: 1000; border: 0; background: rgba(0, 8, 26, 0.48); diff --git a/web/resources/views/venix/admin/static_footer.tpl b/web/resources/views/venix/admin/static_footer.tpl index 251cd3eb..a15d6144 100644 --- a/web/resources/views/venix/admin/static_footer.tpl +++ b/web/resources/views/venix/admin/static_footer.tpl @@ -26,32 +26,6 @@ var sidebarToggle = document.querySelector('.button-toggle-menu'); var sidebarBackdrop = document.querySelector('.admin-sidebar-backdrop'); var sidebarLinks = document.querySelectorAll('.app-sidebar-menu a'); - var viewportFrame = 0; - - function measureViewportHeight() { - var viewport = window.visualViewport; - if (viewport && viewport.height) { - return Math.ceil(viewport.height + Math.max(0, viewport.offsetTop || 0)); - } - - return Math.ceil(Math.max( - window.innerHeight || 0, - document.documentElement.clientHeight || 0 - )); - } - - function applyViewportHeight() { - viewportFrame = 0; - var height = measureViewportHeight(); - if (height > 0) { - document.body.style.setProperty('--admin-viewport-height', height + 'px'); - } - } - - function scheduleViewportHeight() { - if (viewportFrame) return; - viewportFrame = window.requestAnimationFrame(applyViewportHeight); - } function closeSidebar() { document.body.classList.remove('admin-sidebar-open'); @@ -67,18 +41,9 @@ }); } - applyViewportHeight(); - window.addEventListener('resize', scheduleViewportHeight, { passive: true }); - window.addEventListener('orientationchange', scheduleViewportHeight, { passive: true }); - if (window.visualViewport) { - window.visualViewport.addEventListener('resize', scheduleViewportHeight, { passive: true }); - window.visualViewport.addEventListener('scroll', scheduleViewportHeight, { passive: true }); - } - if (sidebarToggle) { sidebarToggle.addEventListener('click', function () { document.body.classList.toggle('admin-sidebar-open'); - scheduleViewportHeight(); }); } @@ -114,7 +79,6 @@ }); window.addEventListener('pageshow', function (event) { - applyViewportHeight(); if (event.persisted) { closeSidebarImmediately(); } diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl index 15db78ee..703b773d 100644 --- a/web/resources/views/venix/layout_assets.tpl +++ b/web/resources/views/venix/layout_assets.tpl @@ -1,2 +1,2 @@ {* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *} -{assign var=venix_asset_version value='2026093001' scope='global'} +{assign var=venix_asset_version value='2026093002' scope='global'} diff --git a/web/tests/AdminOverviewContractTest.php b/web/tests/AdminOverviewContractTest.php index 3bef909b..288f99da 100644 --- a/web/tests/AdminOverviewContractTest.php +++ b/web/tests/AdminOverviewContractTest.php @@ -112,36 +112,35 @@ $assert(str_contains($header, '/theme/venix/css/admin-home.css') && str_contains($styles, '@media (max-width: 575.98px)'), 'Overview must inherit the existing administrator component and responsive rules.'); -$assert(preg_match('/\.admin-template-body\s*\{(?=[^}]*--admin-viewport-height:\s*100vh)(?=[^}]*padding-bottom:\s*0\s*!important)[^}]*\}/s', $styles) - && preg_match('/@supports\s*\(height:\s*100dvh\)\s*\{\s*\.admin-template-body\s*\{[^}]*--admin-viewport-height:\s*100dvh/s', $styles) +$assert(preg_match('/\.admin-template-body\s*\{(?=[^}]*min-height:\s*100dvh)(?=[^}]*padding-bottom:\s*0\s*!important)[^}]*\}/s', $styles) + && !str_contains($styles, '--admin-viewport-height') && preg_match('/\.admin-template#app-layout\s*\{(?=[^}]*height:\s*auto\s*!important)(?=[^}]*overflow:\s*visible\s*!important)[^}]*\}/s', $styles) && preg_match('/\.admin-template \.content-page\s*\{(?=[^}]*display:\s*flex)(?=[^}]*flex-direction:\s*column)[^}]*\}/s', $styles) && preg_match('/\.admin-template \.content\s*\{(?=[^}]*flex:\s*1 0 auto)[^}]*\}/s', $styles) && preg_match('/\.admin-template \.footer\s*\{(?=[^}]*position:\s*static)[^}]*\}/s', $styles) - && preg_match('/\.admin-template \.app-sidebar-menu\s*\{(?=[^}]*inset:\s*0 auto auto 0)(?=[^}]*height:\s*var\(--admin-viewport-height,\s*100dvh\))[^}]*\}/s', $styles) - && preg_match('/\.admin-template-body\.admin-sidebar-open \.admin-sidebar-backdrop\s*\{(?=[^}]*inset:\s*0 0 auto)(?=[^}]*height:\s*var\(--admin-viewport-height,\s*100dvh\))[^}]*\}/s', $styles) + && preg_match('/\.admin-template \.app-sidebar-menu\s*\{(?=[^}]*position:\s*fixed)(?=[^}]*inset:\s*0 auto 0 0)(?=[^}]*height:\s*auto)(?=[^}]*overflow-y:\s*auto)[^}]*\}/s', $styles) + && preg_match('/\.admin-template-body\.admin-sidebar-open \.admin-sidebar-backdrop\s*\{(?=[^}]*position:\s*fixed)(?=[^}]*inset:\s*0\s*;)(?=[^}]*height:\s*auto)[^}]*\}/s', $styles) && str_contains($styles, '.admin-template-body.admin-sidebar-no-transition .app-sidebar-menu') - && str_contains($footer, 'function measureViewportHeight()') - && str_contains($footer, 'window.visualViewport') - && str_contains($footer, "window.visualViewport.addEventListener('resize', scheduleViewportHeight") - && str_contains($footer, "window.visualViewport.addEventListener('scroll', scheduleViewportHeight") + && !str_contains($footer, 'measureViewportHeight') + && !str_contains($footer, 'scheduleViewportHeight') + && !str_contains($footer, 'window.visualViewport') && !str_contains($footer, "window.addEventListener('pagehide', closeSidebar)") && str_contains($footer, "window.addEventListener('pageshow'") && str_contains($footer, 'event.persisted') && str_contains($footer, 'closeSidebarImmediately();') && substr_count($footer, 'window.requestAnimationFrame(function ()') >= 2 - && str_contains($footer, "document.body.classList.toggle('admin-sidebar-open');\n scheduleViewportHeight();") + && str_contains($footer, "document.body.classList.toggle('admin-sidebar-open');") && str_contains($footer, 'target.pathname === current.pathname') && str_contains($footer, 'target.search === current.search') && str_contains($footer, 'target.hash === current.hash') && str_contains($footer, 'event.preventDefault();') && !preg_match('/link\.addEventListener\(\'click\'.*?window\.innerWidth <= 991.*?closeSidebar\(\);/s', $footer), - 'Mobile administrator navigation must cover the measured viewport and keep its overlay during cross-page navigation.'); + 'Mobile administrator navigation must cover the viewport without stale measurements and keep its overlay during cross-page navigation.'); $assetVersion = []; $assert(preg_match("/venix_asset_version value='([0-9]+)'/", $assets, $assetVersion) === 1 - && (int) $assetVersion[1] >= 2026093001 + && (int) $assetVersion[1] >= 2026093002 && str_contains($assets, 'cache key'), - 'This administrator asset release must use cache key 2026093001 or newer.'); + 'This administrator asset release must use cache key 2026093002 or newer.'); echo 'Administrator operational overview contracts passed.' . PHP_EOL;