From 778b35de0958140e7f62f60b52c00807d65326c2 Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Tue, 31 Mar 2026 14:26:15 -0600 Subject: [PATCH] Fix: Clear selection after programmatic focus to prevent Firefox text selection bug (fixes #843) --- js/a11y/browserFocus.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/a11y/browserFocus.js b/js/a11y/browserFocus.js index 1bd96e2d..e8f6a96b 100644 --- a/js/a11y/browserFocus.js +++ b/js/a11y/browserFocus.js @@ -71,6 +71,10 @@ export default class BrowserFocus extends Backbone.Controller { if (!element) return; // refocus on the existing active element to stop jaws from scrolling this.a11y.focus(element, { preventScroll: true }); + // Firefox sets a persistent selection anchor when focus is assigned + // programmatically, causing text to be unexpectedly selected on subsequent + // clicks. Clear any selection to prevent this. + window.getSelection()?.removeAllRanges(); } /**