fix: remove imperative navigation in folder link handler to fix SPA routing

When folderBehavior is 'link', the buttonClickHandler was using
window.location.href with a relative URL (e.g. 'features/'), which
resolved against the current path and broke navigation between folder
pages. Now the handler simply returns, letting the <a> tag's correct
absolute href propagate to the SPA router.
This commit is contained in:
saberzero1 2026-02-13 20:47:51 +01:00
parent cd2b86b64a
commit 9ba62f0f12
No known key found for this signature in database

View file

@ -356,10 +356,10 @@ document.addEventListener("nav", async (e) => {
const folderPath = folderContainer.dataset.folderpath;
if (folderBehavior === "link") {
if (folderPath) {
const folderHref = simplifySlug(folderPath);
window.location.href = folderHref || ".";
}
// When folderBehavior is "link", the <button> has been replaced with an <a> tag
// that has the correct absolute href (e.g. "/features/"). Let the <a> tag's
// native click propagate to the SPA router — don't navigate imperatively here,
// as that would use a relative URL and break SPA navigation.
return;
} else {
evt.stopPropagation();