Skip to content

Commit

Permalink
Screen readers should not say alert for keyword hint message
Browse files Browse the repository at this point in the history
An alert is more suited to situations where the message is not directly related to the user's input.

Bug: None
Change-Id: I4de40267e7aab8ffd4bca5e7efa104591ea04c2b
Reviewed-on: https://chromium-review.googlesource.com/956846
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542352}
  • Loading branch information
aleventhal authored and Commit Bot committed Mar 10, 2018
1 parent 8110e9a commit 218e73f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/ui/views/location_bar/keyword_hint_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ KeywordHintView::KeywordHintView(views::ButtonListener* listener,

// Use leaf alert role so that name is spoken by screen reader, but redundant
// child label text is not also spoken.
GetViewAccessibility().OverrideRole(ax::mojom::Role::kAlert);
GetViewAccessibility().OverrideRole(ax::mojom::Role::kGenericContainer);
GetViewAccessibility().OverrideIsLeaf();
}

Expand Down Expand Up @@ -125,8 +125,8 @@ void KeywordHintView::SetKeyword(const base::string16& keyword) {
trailing_label_->text());
}

// Fire an accessibility alert event, causing the hint to be spoken.
NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true);
// Fire an accessibility event, causing the hint to be spoken.
NotifyAccessibilityEvent(ax::mojom::Event::kLiveRegionChanged, true);
}

gfx::Size KeywordHintView::CalculatePreferredSize() const {
Expand Down
2 changes: 2 additions & 0 deletions ui/accessibility/platform/ax_platform_node_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3566,6 +3566,8 @@ int AXPlatformNodeWin::MSAAEvent(ax::mojom::Event event) {
case ax::mojom::Event::kFocus:
case ax::mojom::Event::kFocusContext:
return EVENT_OBJECT_FOCUS;
case ax::mojom::Event::kLiveRegionChanged:
return EVENT_OBJECT_LIVEREGIONCHANGED;
case ax::mojom::Event::kMenuStart:
return EVENT_SYSTEM_MENUSTART;
case ax::mojom::Event::kMenuEnd:
Expand Down

0 comments on commit 218e73f

Please sign in to comment.