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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 2944083004: MacViews a11y: Support the "Show menu" action in Textfield and Combobox. (Closed)
Patch Set: more interesting test Created 3 years, 6 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 | « ui/views/controls/combobox/combobox.h ('k') | ui/views/controls/combobox/combobox_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 615318fe42c1d7e1a549b7f3fbd8387b5a41eb3f..c98c5596c2cc8cda3cfb78f67b79eb495c793040 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "build/build_config.h"
+#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/default_style.h"
#include "ui/base/ime/input_method.h"
@@ -766,6 +767,20 @@ void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->AddIntAttribute(ui::AX_ATTR_SET_SIZE, model_->GetItemCount());
}
+bool Combobox::HandleAccessibleAction(const ui::AXActionData& action_data) {
+ // The action handling in View would generate a mouse event and send it to
+ // |this|. However, mouse events for Combobox are handled by |arrow_button_|,
+ // which is hidden from the a11y tree (so can't expose actions). Rather than
+ // forwarding AX_ACTION_DO_DEFAULT to View and then forwarding the mouse event
+ // it generates to |arrow_button_| to have it forward back to |this| (as its
+ // ButtonListener), just handle the action explicitly here and bypass View.
+ if (enabled() && action_data.action == ui::AX_ACTION_DO_DEFAULT) {
+ ShowDropDownMenu(ui::MENU_SOURCE_KEYBOARD);
+ return true;
+ }
+ return View::HandleAccessibleAction(action_data);
+}
+
void Combobox::ButtonPressed(Button* sender, const ui::Event& event) {
if (!enabled())
return;
« no previous file with comments | « ui/views/controls/combobox/combobox.h ('k') | ui/views/controls/combobox/combobox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698