Chromium Code Reviews| 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..aa68ba670e77007e562d191b433b319888455a80 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" |
| @@ -761,11 +762,25 @@ void Combobox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| if (enabled()) { |
| node_data->AddIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB, |
| ui::AX_DEFAULT_ACTION_VERB_OPEN); |
| + node_data->AddAction(ui::AX_ACTION_SHOW_CONTEXT_MENU); |
| } |
| node_data->AddIntAttribute(ui::AX_ATTR_POS_IN_SET, selected_index_); |
| 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. |
| + // Also handle AX_SHOW_CONTEXT_MENU so that a "show menu" action is exposed to |
| + // native accessibility tools. |
| + if (enabled() && (action_data.action == ui::AX_ACTION_DO_DEFAULT || |
| + action_data.action == ui::AX_ACTION_SHOW_CONTEXT_MENU)) { |
|
dmazzoni
2017/06/21 06:09:35
Wait, so the SHOW_CONTEXT_MENU action also drops d
tapted
2017/06/21 06:52:55
Cocoa offers both "press" and "show menu" actions
|
| + ShowDropDownMenu(ui::MENU_SOURCE_KEYBOARD); |
| + return true; |
| + } |
| + return View::HandleAccessibleAction(action_data); |
| +} |
| + |
| void Combobox::ButtonPressed(Button* sender, const ui::Event& event) { |
| if (!enabled()) |
| return; |