From b15e46b7d079b855977e18f3b440cacfb6f03783 Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Tue, 31 Mar 2026 18:32:36 +0800 Subject: [PATCH 1/2] fix: enhance sidebar navigation link selection for decoded URLs --- src/core/render/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/render/index.js b/src/core/render/index.js index 9e546a3d01..c1315e07db 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -315,8 +315,11 @@ export function Render(Base) { sidebarToggleEl.setAttribute('aria-expanded', String(!isMobile())); const activeElmHref = this.router.toURL(this.route.path); + const decodedHref = decodeURIComponent(activeElmHref); const activeEl = /** @type {HTMLElement | null} */ ( - dom.find(`.sidebar-nav a[href="${activeElmHref}"]`) + dom.find( + `.sidebar-nav a[href="${activeElmHref}"]${activeElmHref !== decodedHref ? `, .sidebar-nav a[href="${decodedHref}"]` : ''}`, + ) ); this.#addTextAsTitleAttribute('.sidebar-nav a'); From f70137c62774a9e07da016b0360a928261d09cc5 Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Tue, 31 Mar 2026 18:50:12 +0800 Subject: [PATCH 2/2] fix: simplify sidebar navigation link selection for active route --- src/core/render/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/render/index.js b/src/core/render/index.js index c1315e07db..f4db193754 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -314,12 +314,11 @@ export function Render(Base) { sidebarToggleEl.setAttribute('aria-expanded', String(!isMobile())); - const activeElmHref = this.router.toURL(this.route.path); - const decodedHref = decodeURIComponent(activeElmHref); + const activeElmHref = decodeURIComponent( + this.router.toURL(this.route.path), + ); const activeEl = /** @type {HTMLElement | null} */ ( - dom.find( - `.sidebar-nav a[href="${activeElmHref}"]${activeElmHref !== decodedHref ? `, .sidebar-nav a[href="${decodedHref}"]` : ''}`, - ) + dom.find(`.sidebar-nav a[href="${activeElmHref}"]`) ); this.#addTextAsTitleAttribute('.sidebar-nav a');