Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Unified Diff: ui/accessibility/platform/ax_platform_node_mac.mm

Issue 2010493005: a11y/Mac: Add screenreader support for SubtleNotificationView announcements. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/subtle_notification_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/platform/ax_platform_node_mac.mm
diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm
index 88ab503003939c38fe2445d8d7efe90d2dd0a465..ea1372573832a80c54b0b489c83e939f3156584e 100644
--- a/ui/accessibility/platform/ax_platform_node_mac.mm
+++ b/ui/accessibility/platform/ax_platform_node_mac.mm
@@ -8,6 +8,7 @@
#include <stddef.h>
#include "base/macros.h"
+#import "base/mac/sdk_forward_declarations.h"
#include "base/strings/sys_string_conversions.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_view_state.h"
@@ -199,10 +200,11 @@ RoleMap BuildSubroleMap() {
EventMap BuildEventMap() {
const EventMapEntry events[] = {
+ {ui::AX_EVENT_CHILDREN_CHANGED, NSAccessibilityLayoutChangedNotification},
{ui::AX_EVENT_TEXT_CHANGED, NSAccessibilityTitleChangedNotification},
- {ui::AX_EVENT_VALUE_CHANGED, NSAccessibilityValueChangedNotification},
{ui::AX_EVENT_TEXT_SELECTION_CHANGED,
NSAccessibilitySelectedTextChangedNotification},
+ {ui::AX_EVENT_VALUE_CHANGED, NSAccessibilityValueChangedNotification},
// TODO(patricialor): Add more events.
};
@@ -558,6 +560,18 @@ void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) {
// Add mappings between ui::AXEvent and NSAccessibility notifications using
// the EventMap above. This switch contains exceptions to those mappings.
switch (event_type) {
+ case ui::AX_EVENT_ALERT: {
+ NSString* announcement = base::SysUTF8ToNSString(
+ GetData().GetStringAttribute(ui::AX_ATTR_NAME));
+ NSDictionary* notification_info = @{
+ NSAccessibilityAnnouncementKey : announcement,
+ NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
+ };
+ NSAccessibilityPostNotificationWithUserInfo(
+ [NSApp mainWindow], NSAccessibilityAnnouncementRequestedNotification,
+ notification_info);
+ return;
+ }
case ui::AX_EVENT_TEXT_CHANGED:
// If the view is a user-editable textfield, this should change the value.
if (GetData().role == ui::AX_ROLE_TEXT_FIELD) {
« no previous file with comments | « chrome/browser/ui/views/subtle_notification_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698