• Kurt Catti-Schmidt (SCHMIDT)'s avatar
    Fire focus events on nodes when the frame isn't already focused. · 03e2bfa9
    Kurt Catti-Schmidt (SCHMIDT) authored
    This change fixes a particular issue where the Javascript "onfocus()"
    event doesn't fire when accessibility API's call focus() on a
    specific node when the frame containing that node doesn't currently
    have focus.
    
    Blink's implementation of "onfocus()" in Document::SetFocusedElement has
    a condition under GetPage()->GetFocusController().IsFocused() to prevent
    focus from being fired if the page doesn't have focus. This is correct
    behavior from Javascript's perspective.
    
    From the accessibility side, behavior was already added to focus on the
    document before focusing on a specific node in
    https://chromium-review.googlesource.com/c/chromium/src/+/1809943
    
    However, when that change calls into
    RenderFrameHostImpl::AccessibilityViewSetFocus, if the view is a
    RenderWidgetHostViewChildFrame, nothing will happen, as that method is
    empty. So this change completes that method with a simple focus
    implementation.
    
    A browser test was added to confirm that the Javascript onfocus event
    is properly fired.
    
    Bug: 1124067
    Change-Id: I5a77fcdfba96da45fe548e93c2da8c9a69181066
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389005
    Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
    Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
    Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#805465}
    03e2bfa9
iframe-focus.html 357 Bytes