Skip to content

Commit a3ed084

Browse files
wikirbyclaude
andcommitted
Align focus with aria-pressed on Region snap-back to FullPage
After pressing Esc on the Region overlay with no clip, the snap-back clicked the fallback (Full Page) button — flipping aria-pressed to match — but then explicitly focused the Region button. Screen readers announced the wrong state ("Region toggle button, not pressed") while the visual selected state correctly showed Full Page. Focus the fallback button instead so aria-pressed and focus stay aligned. Also covers the same pattern for non-FullPage fallbacks (if modeBeforeRegion was Article, focus lands on Article after Esc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cf84423 commit a3ed084

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/scripts/renderer.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,9 +3010,11 @@ port.onMessage.addListener((message: any) => {
30103010
if (regionImages.length === 0) {
30113011
let fallbackMode = modeBeforeRegion || (pdfMode ? "pdf" : "fullpage");
30123012
let fallbackBtn = document.querySelector('.mode-btn[data-mode="' + fallbackMode + '"]') as HTMLButtonElement;
3013-
if (fallbackBtn) { fallbackBtn.click(); }
3014-
let regionBtn = document.querySelector('.mode-btn[data-mode="region"]') as HTMLElement;
3015-
if (regionBtn) { setTimeout(function() { regionBtn.focus(); }, 0); }
3013+
if (fallbackBtn) {
3014+
fallbackBtn.click();
3015+
// Focus follows aria-pressed — screen readers otherwise announce the wrong button state.
3016+
setTimeout(function() { fallbackBtn.focus(); }, 0);
3017+
}
30163018
} else {
30173019
// User cancelled mid-add but already has captures — stay in region mode
30183020
// so they can save what they have or add another region.

0 commit comments

Comments
 (0)