Mirror of https://github.com/improsocial/impro An extensible Bluesky client for web impro.social
5

Configure Feed

Select the types of activity you want to include in your feed.

Fix router blurring issue

Grace Kind (Jul 15, 2026, 6:38 PM -0500) faefa69f 43f6cf11

+35 -1
+1 -1
package.json
··· 1 1 { 2 2 "name": "impro", 3 - "version": "0.17.167", 3 + "version": "0.17.168", 4 4 "type": "module", 5 5 "scripts": { 6 6 "start": "rm -rf \"${BUILD_DIR:-build}\" && NODE_ENV=development eleventy --serve",
+6
src/js/router.js
··· 222 222 // Strip query parameters for route matching (but keep full path for caching) 223 223 const pathname = path.split("?")[0]; 224 224 if (this.currentPage) { 225 + // Safari can keep processing a focused search control after its page is 226 + // hidden. Release focus before moving the page into the route cache. 227 + const activeElement = document.activeElement; 228 + if (activeElement && this.currentPage.contains(activeElement)) { 229 + activeElement.blur(); 230 + } 225 231 this.currentPage.dispatchEvent(new CustomEvent("page-exit")); 226 232 this.currentPage.classList.remove("page-visible"); 227 233 this.currentPage.classList.add("page-hidden");
+28
tests/unit/specs/router.test.js
··· 364 364 365 365 assert.deepEqual(receivedParams, { id: "123" }); 366 366 }); 367 + 368 + it("should blur a focused control on the page being hidden", async () => { 369 + const router = new Router(); 370 + const { root } = mountRouter(router); 371 + document.body.appendChild(root); 372 + router.addRoute("/search", () => Promise.resolve({})); 373 + router.addRoute("/profile", () => Promise.resolve({})); 374 + let renderCount = 0; 375 + router.renderRoute(({ container }) => { 376 + if (renderCount++ === 0) { 377 + const input = document.createElement("input"); 378 + container.appendChild(input); 379 + } 380 + }); 381 + 382 + try { 383 + await router.load("/search"); 384 + const input = router.currentPage.querySelector("input"); 385 + input.focus(); 386 + assert.deepEqual(document.activeElement, input); 387 + 388 + await router.load("/profile"); 389 + 390 + assert.notDeepEqual(document.activeElement, input); 391 + } finally { 392 + root.remove(); 393 + } 394 + }); 367 395 }); 368 396 369 397 describe("go", () => {