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

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

Issue 2944083004: MacViews a11y: Support the "Show menu" action in Textfield and Combobox. (Closed)
Patch Set: Mac-specific 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
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..7117665a2407e8f275bbef0346b3011536ecb51e 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,16 @@ 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, but mouse events
+ // for Combobox are handled by |arrow_button_|. Handle the action explicitly.
msw 2017/06/29 19:26:12 nit: It's not clear from this comment why allowing
tapted 2017/06/30 06:04:47 The problem is that |arrow_button_| isn't exposed
+ if (enabled() && action_data.action == ui::AX_ACTION_DO_DEFAULT) {
msw 2017/06/29 19:26:12 Do we need some logic for handling the event when
tapted 2017/06/30 06:04:47 I don't think so. I am not a VoiceOver expert but
+ ShowDropDownMenu(ui::MENU_SOURCE_KEYBOARD);
+ return true;
+ }
+ return View::HandleAccessibleAction(action_data);
+}
+
void Combobox::ButtonPressed(Button* sender, const ui::Event& event) {
if (!enabled())
return;

Powered by Google App Engine
This is Rietveld 408576698