Skip to content

Commit e755c48

Browse files
committed
Fix focus tests - change th order, first push to the history, then do enhanced load.
1 parent ba8dd72 commit e755c48

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Components/Web.JS/src/Services/NavigationEnhancement.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,22 @@ function onDocumentClick(event: MouseEvent) {
111111
}
112112

113113
handleClickForNavigationInterception(event, absoluteInternalHref => {
114+
const originalLocation = location.href;
114115
saveScrollPosition();
116+
115117
const shouldScrollToHash = isSamePageWithHash(absoluteInternalHref);
118+
history.pushState(null, /* ignored title */ '', absoluteInternalHref);
116119

117120
if (shouldScrollToHash) {
118121
performScrollToElementOnTheSamePage(absoluteInternalHref);
119122
} else {
120-
let isSelfNavigation = isForSamePath(absoluteInternalHref, location.href);
123+
let isSelfNavigation = isForSamePath(absoluteInternalHref, originalLocation);
121124
performEnhancedPageLoad(absoluteInternalHref, /* interceptedLink */ true);
122125
if (!isSelfNavigation) {
123126
resetScrollAfterNextBatch();
124127
resetScrollIfNeeded();
125128
}
126129
}
127-
128-
history.pushState(null, /* ignored title */ '', absoluteInternalHref);
129130
});
130131
}
131132

0 commit comments

Comments
 (0)