Commit 2fabc022 authored by Jenny Zhang's avatar Jenny Zhang Committed by Commit Bot

Fix the zero state vox issue caused by nested buttons.

Bug: 924776,934565
Change-Id: Icc39b20b0fd819ef0c3551bb82cf230758a6a20b
Reviewed-on: https://chromium-review.googlesource.com/c/1481079
Commit-Queue: Jenny Zhang <jennyz@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634908}
parent d2a40562
...@@ -137,6 +137,9 @@ void SearchResultListView::SearchResultActionActivated(SearchResultView* view, ...@@ -137,6 +137,9 @@ void SearchResultListView::SearchResultActionActivated(SearchResultView* view,
view_delegate_->InvokeSearchResultAction(view->result()->id(), view_delegate_->InvokeSearchResultAction(view->result()->id(),
action_index, event_flags); action_index, event_flags);
} else if (action == ash::OmniBoxZeroStateAction::kAppendSuggestion) { } else if (action == ash::OmniBoxZeroStateAction::kAppendSuggestion) {
// Make sure ChromeVox will focus on the search box.
main_view_->search_box_view()->search_box()->NotifyAccessibilityEvent(
ax::mojom::Event::kSelection, true);
main_view_->search_box_view()->UpdateQuery(view->result()->title()); main_view_->search_box_view()->UpdateQuery(view->result()->title());
} }
} }
......
...@@ -365,6 +365,25 @@ void SearchResultView::OnMouseExited(const ui::MouseEvent& event) { ...@@ -365,6 +365,25 @@ void SearchResultView::OnMouseExited(const ui::MouseEvent& event) {
actions_view_->UpdateButtonsOnStateChanged(); actions_view_->UpdateButtonsOnStateChanged();
} }
void SearchResultView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
if (!visible())
return;
// This is a work around to deal with the nested button case(append and remove
// button are child button of SearchResultView), which is not supported by
// ChromeVox. see details in crbug.com/924776.
// We change the role of the parent view SearchResultView to kGenericContainer
// i.e., not a kButton anymore.
node_data->role = ax::mojom::Role::kGenericContainer;
node_data->AddState(ax::mojom::State::kFocusable);
node_data->SetDefaultActionVerb(ax::mojom::DefaultActionVerb::kClick);
node_data->SetName(GetAccessibleName());
}
void SearchResultView::VisibilityChanged(View* starting_from, bool is_visible) {
NotifyAccessibilityEvent(ax::mojom::Event::kLayoutComplete, true);
}
void SearchResultView::OnGestureEvent(ui::GestureEvent* event) { void SearchResultView::OnGestureEvent(ui::GestureEvent* event) {
switch (event->type()) { switch (event->type()) {
case ui::ET_GESTURE_LONG_PRESS: case ui::ET_GESTURE_LONG_PRESS:
......
...@@ -96,6 +96,8 @@ class APP_LIST_EXPORT SearchResultView ...@@ -96,6 +96,8 @@ class APP_LIST_EXPORT SearchResultView
void OnBlur() override; void OnBlur() override;
void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseEntered(const ui::MouseEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void VisibilityChanged(View* starting_from, bool is_visible) override;
// ui::EventHandler overrides: // ui::EventHandler overrides:
void OnGestureEvent(ui::GestureEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override;
......
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