mirror of
https://github.com/Xevion/banner.git
synced 2026-02-01 04:23:40 -06:00
fix(web): skip view transitions for same-page navigations
Prevents document-level view transitions from blocking pointer events during query param updates (e.g. filter changes). Only use transitions when the pathname actually changes.
This commit is contained in:
@@ -70,8 +70,14 @@ export function initNavigation() {
|
||||
});
|
||||
|
||||
onNavigate((navigation) => {
|
||||
if (!document.startViewTransition) {
|
||||
// No view transitions — update path when navigation completes
|
||||
// Skip document-level view transitions for same-page navigations (e.g.
|
||||
// query param updates from filter changes). Document transitions apply
|
||||
// visibility:hidden to the entire page, blocking all pointer interaction.
|
||||
const fromPath = navigation.from?.url.pathname;
|
||||
const toPath = navigation.to?.url.pathname;
|
||||
const isPageChange = fromPath !== toPath;
|
||||
|
||||
if (!document.startViewTransition || !isPageChange) {
|
||||
navigation.complete.then(() => {
|
||||
navbar.path = window.location.pathname;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user