patches: 0008 - setAccessibilityElement:NO (suppress window announcement)

This commit is contained in:
2026-02-28 16:34:41 +01:00
parent 2dc4182856
commit 5a58e3b925

View File

@@ -1,4 +1,4 @@
From a06955c951aaad2330add250f815c34d60128948 Mon Sep 17 00:00:00 2001 From ee7441e38dc428f86c36045648bac2c487768f48 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 16:01:29 +0100 Date: Sat, 28 Feb 2026 16:01:29 +0100
Subject: [PATCH 2/2] ns: announce child frame completion candidates for Subject: [PATCH 2/2] ns: announce child frame completion candidates for
@@ -31,14 +31,15 @@ Safety measures:
- Buffer size limit (10000 chars) skips non-completion child frames - Buffer size limit (10000 chars) skips non-completion child frames
such as eldoc documentation or which-key popups. such as eldoc documentation or which-key popups.
Suppress VoiceOver's automatic "X window" announcement by setting Remove the child frame window from the accessibility tree via
the child frame's accessibility subrole to FloatingWindow (popovers setAccessibilityElement:NO to prevent VoiceOver's blocking
and floating windows don't trigger window-appeared announcements). "X window" announcement. Our candidate announcements go to NSApp
(not the window element) and are unaffected.
Zoom tracking stores the candidate rect in the PARENT frame's Zoom tracking stores the candidate rect in the PARENT frame's
overlayZoomRect (via screen coordinate conversion), so that the overlayZoomRect (via child view -> screen -> parent view coordinate
parent's draw_window_cursor focuses Zoom on the candidate instead conversion), so that the parent's draw_window_cursor focuses Zoom
of the text cursor. Cleared when no candidate is found. on the candidate instead of the text cursor.
* src/nsterm.h (EmacsView): Add announceChildFrameCompletion. * src/nsterm.h (EmacsView): Add announceChildFrameCompletion.
* src/nsterm.m (ns_ax_selected_child_frame_text): New function. * src/nsterm.m (ns_ax_selected_child_frame_text): New function.
@@ -63,7 +64,7 @@ index 5c15639..21b2823 100644
@end @end
diff --git a/src/nsterm.m b/src/nsterm.m diff --git a/src/nsterm.m b/src/nsterm.m
index d13c5c7..ea2a914 100644 index d13c5c7..3735f01 100644
--- a/src/nsterm.m --- a/src/nsterm.m
+++ b/src/nsterm.m +++ b/src/nsterm.m
@@ -7066,6 +7066,110 @@ ns_ax_selected_overlay_text (struct buffer *b, @@ -7066,6 +7066,110 @@ ns_ax_selected_overlay_text (struct buffer *b,
@@ -245,10 +246,10 @@ index d13c5c7..ea2a914 100644
+ lastCandidate = xstrdup (cstr); + lastCandidate = xstrdup (cstr);
+ +
+ /* Suppress VoiceOver's automatic "X window" announcement for + /* Suppress VoiceOver's automatic "X window" announcement for
+ the child frame. Completion popups are semantically popovers, + the child frame by removing it from the accessibility tree.
+ not windows. Setting the subrole once is idempotent. */ + Our candidate announcement goes to NSApp (not this window),
+ [[self window] + so it still reaches VoiceOver. Idempotent. */
+ setAccessibilitySubrole:NSAccessibilityFloatingWindowSubrole]; + [[self window] setAccessibilityElement:NO];
+ +
+ NSDictionary *annInfo = @{ + NSDictionary *annInfo = @{
+ NSAccessibilityAnnouncementKey: candidate, + NSAccessibilityAnnouncementKey: candidate,