Commit 5f3fd1ba authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac a11y: Don't coerce textfield title change events to value change

It's not clear why we're doing this, since we already set the text
of text fields as "value", so this just suppresses legitimate title
changed notifications.

Bug: None
Change-Id: I75a9e4fe68262cb45b37f817fd38d28a3de8093f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764273
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696875}
parent 5a5580c7
...@@ -311,11 +311,6 @@ void PostAnnouncementNotification(NSString* announcement) { ...@@ -311,11 +311,6 @@ void PostAnnouncementNotification(NSString* announcement) {
} }
void NotifyMacEvent(AXPlatformNodeCocoa* target, ax::mojom::Event event_type) { void NotifyMacEvent(AXPlatformNodeCocoa* target, ax::mojom::Event event_type) {
NSString* announcement_text = [target announcementTextForEvent:event_type];
if (announcement_text) {
PostAnnouncementNotification(announcement_text);
return;
}
NSString* notification = NSString* notification =
[AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]; [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type];
if (notification) if (notification)
...@@ -1150,27 +1145,21 @@ gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { ...@@ -1150,27 +1145,21 @@ gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() {
void AXPlatformNodeMac::NotifyAccessibilityEvent(ax::mojom::Event event_type) { void AXPlatformNodeMac::NotifyAccessibilityEvent(ax::mojom::Event event_type) {
GetNativeViewAccessible(); GetNativeViewAccessible();
// Add mappings between ax::mojom::Event and NSAccessibility notifications // Handle special cases.
// using the EventMap above. This switch contains exceptions to those NSString* announcement_text =
// mappings. [native_node_ announcementTextForEvent:event_type];
switch (event_type) { if (announcement_text) {
case ax::mojom::Event::kTextChanged: PostAnnouncementNotification(announcement_text);
// If the view is a user-editable textfield, this should change the value. return;
if (GetData().role == ax::mojom::Role::kTextField) { }
NotifyMacEvent(native_node_, ax::mojom::Event::kValueChanged); if (event_type == ax::mojom::Event::kSelection &&
return; ui::IsMenuItem(GetData().role)) {
} // On Mac, map menu item selection to a focus event.
break; NotifyMacEvent(native_node_, ax::mojom::Event::kFocus);
case ax::mojom::Event::kSelection: return;
// On Mac, map menu item selection to a focus event.
if (ui::IsMenuItem(GetData().role)) {
NotifyMacEvent(native_node_, ax::mojom::Event::kFocus);
return;
}
break;
default:
break;
} }
// Otherwise, use mappings between ax::mojom::Event and NSAccessibility
// notifications from the EventMap above.
NotifyMacEvent(native_node_, event_type); NotifyMacEvent(native_node_, event_type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment