Focus the Document Element when requested from Accessibility
With the Narrator setting "Sync the Narrator cursor and system focus" enabled, and the user navigates from the browser UI into the document frame, the root Document should be focused. If IFrame content had focus before it was moved to the browser UI, when returning to the document frame the last focused item within the IFrame regains focus. This happens either when using the Tab key or Narrator Item Navigation. With Narrator Item Navigation however, the focus should be moved to the root Document upon entering the document frame. This is because Narrator explicitly requests focus on the item via IRawElementProviderFragment::SetFocus (AXPlatformNodeWin::SetFocus). This ends up calling BrowserAccessibilityManager::SetFocus which attempts to do 2 things in this scenario : (1) Return focus to the Accessibility View (AccessibilityViewSetFocus) (2) Focus the target Element (AccessibilityPerformAction) AccessibilityViewSetFocus ends up focusing the IFrame content with this approximate stack : AccessibilityViewSetFocus BrowserAccessibilityManager::OnWindowFocused BrowserAccessibilityManager::FireFocusEventsIfNeeded BrowserAccessibilityManager::GetFocus BrowserAccessibilityManager::GetFocusFromThisOrDescendantFrame BrowserAccessibilityManager::FireFocusEvent After focus has been returned to the IFrame content, the call to AccessibilityPerformAction should now focus the targeted element. However this does not happen because it ends up calling AXNodeObject::OnNativeFocusAction which only calls ClearFocusedElement for the root document. This call does not affect the nested Frame, and focus remains within the IFrame. This change aims to fix this corner case, and allow focus to be set on the requested Document. Bug: 1064339 Change-Id: I5648483a4463ecd8e4105624c84293e0be68f8f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116541Reviewed-by:Aaron Leventhal <aleventhal@chromium.org> Commit-Queue: Adam Ettenberger <Adam.Ettenberger@microsoft.com> Cr-Commit-Position: refs/heads/master@{#753775}
Showing
Please register or sign in to comment