fix: close mobile menu on PWA back button and page restore
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Mobile menu stayed open after history.back() due to bfcache restoring the page with menu in active state. Now closes menu before navigating back, and on pageshow event to handle bfcache restore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b7965cd09b
commit
776e84b3dc
@ -93,7 +93,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav role="navigation" aria-label="Main navigation">
|
<nav role="navigation" aria-label="Main navigation">
|
||||||
<button class="pwa-back-btn" onclick="history.back()" aria-label="Cofnij">
|
<button class="pwa-back-btn" onclick="event.stopPropagation();var m=document.getElementById('navMenu');if(m)m.classList.remove('active');if(history.length>1){history.back();}else{location.href='/';}" aria-label="Cofnij">
|
||||||
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 10H5m0 0l5-5m-5 5l5 5"/></svg>
|
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 10H5m0 0l5-5m-5 5l5 5"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<a href="{{ url_for('index') }}" class="nav-brand" aria-label="Norda Biznes Home">
|
<a href="{{ url_for('index') }}" class="nav-brand" aria-label="Norda Biznes Home">
|
||||||
@ -738,6 +738,12 @@
|
|||||||
menu.classList.toggle('active');
|
menu.classList.toggle('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close mobile menu on back/forward navigation (bfcache)
|
||||||
|
window.addEventListener('pageshow', function() {
|
||||||
|
var m = document.getElementById('navMenu');
|
||||||
|
if (m) m.classList.remove('active');
|
||||||
|
});
|
||||||
|
|
||||||
// Auto-dismiss flash messages after 5 seconds
|
// Auto-dismiss flash messages after 5 seconds
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const flashes = document.querySelectorAll('.flash');
|
const flashes = document.querySelectorAll('.flash');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user