Skip to content

Commit 17042b9

Browse files
Mylio Sysopsclaude
andcommitted
OLYM-9850: [macOS] A disabled control is still read by VoiceOver, as dimmed
With the restriction from upstream flutter#190353 in place, a disabled button or checkbox reached macOS with no role, no name and no AXEnabled: VoiceOver found an empty element where the control was. -[AXPlatformNodeCocoa isAccessibilitySelectorAllowed:] returned NO for every selector on a node whose restriction is kDisabled. AppKit asks it for every accessibility method this class implements, the getters included (accessibilityRole, accessibilityLabel, isAccessibilityEnabled), so it hid the whole element. Upstream master has the same code, so upstream's fix has the same effect on a real Mac; its tests call the getters directly, which skips AppKit's check. Fix: a disabled node refuses only the setters and the accessibilityPerform actions, like a disabled AppKit control, and is read as before. VoiceOver then reads "Ignore untagged faces, dimmed, button" and "Info, dimmed, checked, checkbox". Test: FlutterPlatformNodeDelegateMac.DisabledControlsAreNotAccessibilityEnabled now also checks which selectors a disabled button allows. UPSTREAM-CANDIDATES.md entry 14. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent aa73c70 commit 17042b9

3 files changed

Lines changed: 55 additions & 5 deletions

File tree

‎UPSTREAM-CANDIDATES.md‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,31 @@ for VoiceOver's focus.
250250
**PR needs:** the commit as is. It carries a test,
251251
`FlutterTextInputSemanticsObjectTest.ReportsItsSemanticsParentToAccessibility`.
252252

253+
## 14. macOS: a disabled control is an empty element to VoiceOver
254+
255+
**Commit:** `OLYM-9850: [macOS] A disabled control is still read by VoiceOver, as dimmed`
256+
**File:** `third_party/accessibility/ax/platform/ax_platform_node_mac.mm`
257+
**Upstream:** unfixed; on master `-[AXPlatformNodeCocoa isAccessibilitySelectorAllowed:]`
258+
still returns NO for every selector of a node whose restriction is `kDisabled`.
259+
Upstream #190353 (2026-08-03, carried here as a cherry-pick, see "Not
260+
candidates") made the bridge set that restriction, so master has the bug for
261+
every disabled control.
262+
263+
**Issue text.** On macOS a Flutter control that is off (a button with
264+
`enabled: false`, a checkbox that can't be changed) shows up to VoiceOver as an
265+
empty element: no role, no name, no AXEnabled. `isAccessibilitySelectorAllowed:`
266+
returns NO for every selector when the node is disabled, and AppKit asks it for
267+
every accessibility method the class implements, the getters included
268+
(`accessibilityRole`, `accessibilityLabel`, `isAccessibilityEnabled`). Unit tests
269+
that call those getters directly don't see it, because they skip AppKit's check.
270+
Fix: a disabled node refuses only the setters and the `accessibilityPerform…`
271+
actions, like a disabled AppKit control; VoiceOver then reads it with its name
272+
and "dimmed".
273+
274+
**PR needs:** the commit as is, with the cherry-pick of #190353 already on
275+
master. It carries a test,
276+
`FlutterPlatformNodeDelegateMac.DisabledControlsAreNotAccessibilityEnabled`.
277+
253278
## Formatting status
254279

255280
Checked 2026-10-13 with the engine's own tools: clang-format (buildtools),
@@ -290,9 +315,9 @@ build time.
290315
entries 12 and 13 above also change on this branch, and a disabled text field
291316
shown that way would still reach the `FlutterTextField` cast in
292317
`AccessibilityBridgeMac`'s `VALUE_CHANGED` case. Check that case when the
293-
SDK moves to 3.50 or later; then this cherry-pick falls away, and the macOS
294-
test added with it (`FlutterPlatformNodeDelegateMac.DisabledControlsAreNotAccessibilityEnabled`)
295-
can be dropped or filed upstream.
318+
SDK moves to 3.50 or later; then this cherry-pick falls away. Entry 14 does
319+
not: without it, the restriction this sets hides a disabled control from
320+
VoiceOver on macOS.
296321
- `Fix Xcode 27 lipo verification failure for Darwin frameworks (#188625)` and
297322
the two AHB swapchain commits by Jason Simmons are upstream commits.
298323
- The F16/EDR/HDR compositing stack itself (macOS, iOS, Android, Windows,

‎engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMacTest.mm‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,10 @@
481481
// not enabled (AXEnabled = NO), so VoiceOver reads it as "dimmed". Before the
482482
// accessibility bridge set the node's restriction, every Flutter button and
483483
// checkbox on the Mac reported AXEnabled = YES, whatever the app said.
484+
// AppKit reads an element only through the selectors that
485+
// isAccessibilitySelectorAllowed: allows, so a disabled control must still
486+
// allow its getters (its role, name and enabled state), and refuse only its
487+
// setters and actions.
484488
TEST(FlutterPlatformNodeDelegateMac, DisabledControlsAreNotAccessibilityEnabled) {
485489
FlutterViewController* viewController = CreateTestViewController();
486490
FlutterEngine* engine = viewController.engine;
@@ -536,6 +540,14 @@
536540
ASSERT_NE(disabled_button, nil);
537541
EXPECT_TRUE([[disabled_button accessibilityRole] isEqualToString:NSAccessibilityButtonRole]);
538542
EXPECT_FALSE([disabled_button isAccessibilityEnabled]);
543+
EXPECT_TRUE([disabled_button isAccessibilitySelectorAllowed:@selector(accessibilityRole)]);
544+
EXPECT_TRUE([disabled_button isAccessibilitySelectorAllowed:@selector(accessibilityLabel)]);
545+
EXPECT_TRUE([disabled_button isAccessibilitySelectorAllowed:@selector(isAccessibilityEnabled)]);
546+
EXPECT_FALSE(
547+
[disabled_button isAccessibilitySelectorAllowed:@selector(accessibilityPerformPress)]);
548+
EXPECT_FALSE(
549+
[disabled_button isAccessibilitySelectorAllowed:@selector(setAccessibilityFocused:)]);
550+
EXPECT_FALSE([disabled_button isAccessibilitySelectorAllowed:@selector(setAccessibilityValue:)]);
539551

540552
id enabled_button =
541553
bridge->GetFlutterPlatformNodeDelegateFromID(2).lock()->GetNativeViewAccessible();
@@ -548,6 +560,7 @@
548560
ASSERT_NE(disabled_checkbox, nil);
549561
EXPECT_TRUE([[disabled_checkbox accessibilityRole] isEqualToString:NSAccessibilityCheckBoxRole]);
550562
EXPECT_FALSE([disabled_checkbox isAccessibilityEnabled]);
563+
EXPECT_TRUE([disabled_checkbox isAccessibilitySelectorAllowed:@selector(accessibilityValue)]);
551564

552565
[engine shutDownEngine];
553566
}

‎engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_mac.mm‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,20 @@ - (BOOL)isAccessibilitySelectorAllowed:(SEL)selector {
815815
return NO;
816816

817817
const ax::mojom::Restriction restriction = _node->GetData().GetRestriction();
818-
if (restriction == ax::mojom::Restriction::kDisabled)
819-
return NO;
818+
if (restriction == ax::mojom::Restriction::kDisabled) {
819+
// AppKit asks this for every accessibility method of this class, the
820+
// getters included (accessibilityRole, accessibilityLabel,
821+
// isAccessibilityEnabled). Refusing them all left a disabled control in
822+
// the tree with no role, no name and no AXEnabled, so VoiceOver could not
823+
// read it at all. A disabled control is still read, and is "dimmed"
824+
// through isAccessibilityEnabled; like a disabled AppKit control, it
825+
// refuses only what would change it or act on it: the setters and the
826+
// accessibilityPerform actions.
827+
NSString* name = NSStringFromSelector(selector);
828+
if ([name hasPrefix:@"set"] || [name hasPrefix:@"accessibilityPerform"])
829+
return NO;
830+
return [super isAccessibilitySelectorAllowed:selector];
831+
}
820832

821833
if (selector == @selector(setAccessibilityValue:)) {
822834
// Tabs use the radio button role on Mac, so they are selected by calling

0 commit comments

Comments
 (0)