Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility_manager_mac.mm |
| diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| index 097eb4479097b51c2c9ffa1212571e19b11edb68..d8936615b53d9539492222755adea0d60242aa49 100644 |
| --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| @@ -132,9 +132,13 @@ ui::AXTreeUpdate |
| BrowserAccessibility* BrowserAccessibilityManagerMac::GetFocus() { |
| // On Mac, list boxes should always get focus on the whole list, otherwise |
| // information about the number of selected items will never be reported. |
| + // For combo boxes, focus should stay on the combo box so the user will not be |
|
dmazzoni
2016/04/29 20:55:54
Consider doing this only for combo boxes where IsE
|
| + // taken out of the combo box while typing. |
| BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(); |
| - if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX) |
| + if (node && (node->GetRole() == ui::AX_ROLE_LIST_BOX || |
| + node->GetRole() == ui::AX_ROLE_COMBO_BOX)) { |
| return node; |
| + } |
| // For other roles, follow the active descendant. |
| return GetActiveDescendantFocus(node); |
| @@ -146,20 +150,6 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| if (!node->IsNative()) |
| return; |
| - if (event_type == ui::AX_EVENT_FOCUS) { |
| - BrowserAccessibility* active_descendant = GetActiveDescendantFocus(node); |
| - if (active_descendant) |
| - node = active_descendant; |
| - |
| - if (node->GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && |
| - node->HasState(ui::AX_STATE_SELECTED) && |
| - node->GetParent() && |
| - node->GetParent()->GetRole() == ui::AX_ROLE_LIST_BOX) { |
| - node = node->GetParent(); |
| - SetFocus(*node); |
| - } |
| - } |
| - |
| auto native_node = ToBrowserAccessibilityCocoa(node); |
| DCHECK(native_node); |
| @@ -175,7 +165,10 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| // the combo box where the user might be typing. |
| mac_notification = NSAccessibilitySelectedChildrenChangedNotification; |
| } else { |
| - mac_notification = NSAccessibilityFocusedUIElementChangedNotification; |
| + // In all other cases we should post |
| + // |NSAccessibilityFocusedUIElementChangedNotification|, but this is |
| + // handled elsewhere. |
| + return; |
| } |
| break; |
| case ui::AX_EVENT_AUTOCORRECTION_OCCURED: |