ax: fix VoiceOver cursor sync and word double-read

Bug 1 (VO cursor not following Emacs cursor):
- Remove FocusedUIElementChangedNotification on emacsView (was a no-op:
  VO re-queried the same element)
- For Emacs-initiated char/word moves, keep natural next/previous
  direction instead of forcing discontiguous; SelectedTextChanged with
  direction=next advances VO browse cursor sequentially
- Only force discontiguous for line-boundary crossings and large jumps

Bug 2 (word double-read with punctuation):
- Root cause was FocusedUIElementChanged causing VO re-anchor speech
  on top of the explicit word announcement
- Removing FocusedUIElementChanged eliminates the duplicate speech
- Add emacsInitiated parameter to postFocusedCursorNotification;
  omit AXTextSelectionGranularity for Emacs-initiated moves so VO
  does not auto-speak (only explicit announcements provide speech)
- isWordMove now triggers on emacsInitiated flag (Emacs-initiated
  word moves always get explicit announcement)
This commit is contained in:
2026-03-02 12:38:40 +01:00
parent 53ea58725e
commit bc5714b7b7
9 changed files with 124 additions and 118 deletions

View File

@@ -1,4 +1,4 @@
From cd2037fc2078f3db365fa3f222413d9022c882f5 Mon Sep 17 00:00:00 2001
From 9703257f348868b6d28ffb07a32515be05180ab3 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/8] doc: add VoiceOver accessibility section to macOS
@@ -16,7 +16,7 @@ default: initial value is nil, set automatically at startup.
2 files changed, 83 insertions(+), 3 deletions(-)
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 6bd334f..6514dfc 100644
index 6bd334f48e..f3671354b5 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -36,6 +36,7 @@ Support}), but we hope to improve it in the future.
@@ -110,10 +110,10 @@ index 6bd334f..6514dfc 100644
@section GNUstep Support
diff --git a/src/nsterm.m b/src/nsterm.m
index 7574da4..426b029 100644
index 1444ff2d13..25e8aeff34 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -14623,9 +14623,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -14657,9 +14657,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.