Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae2ae09f730f2cbc6aee1ded2f61d8ed5b9d27d1
      
https://github.com/WebKit/WebKit/commit/ae2ae09f730f2cbc6aee1ded2f61d8ed5b9d27d1
  Author: Megan Gardner <[email protected]>
  Date:   2026-01-29 (Thu, 29 Jan 2026)

  Changed paths:
    M Source/WebCore/page/FocusController.cpp
    M Source/WebCore/page/FocusController.h
    M Source/WebCore/page/FocusControllerTypes.h
    M Source/WebCore/page/RemoteFrameClient.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebFrameProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FocusWebView.mm

  Log Message:
  -----------
  Focusing a cross-origin iFrame on iOS results in an unintended focus advance.
https://bugs.webkit.org/show_bug.cgi?id=306390
rdar://169057413

Reviewed by Abrar Rahman Protyasha and Alex Christensen.

When focusing a form control on iOS, we check to see
if there is a control ahead and behind in document order
to display some UI above the keyboard (or just at the bottom
of the screen if there is a hardware keyboard) to allow the user
to advance or back up to the next or previous field. When this
code was given site-isolation support, it accidentally started
advancing the focus instead of just checking if an element existed.

This patch fixes that issue by tracking if we just want to find the
next element, or find and focus the next element. Since many of these
functions did not mention that they could focus the element, I have
updated some names as well as add the ShouldFocusElement variable.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/FocusWebView.mm

* Source/WebCore/page/FocusController.cpp:
(WebCore::FocusController::findFocusableElementStartingWithLocalFrame):
(WebCore::FocusController::findFocusableElementDescendingIntoSubframes):
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::findFocusableElementInDocumentOrderStartingWithFrame):
(WebCore::FocusController::findFocusableElementAcrossFocusScope):
(WebCore::FocusController::findFocusableElementWithinScope):
(WebCore::FocusController::nextFocusableElement):
(WebCore::FocusController::previousFocusableElement):
(WebCore::FocusController::findAndFocusElementStartingWithLocalFrame):
(WebCore::FocusController::findAndFocusElementInDocumentOrderStartingWithFrame):
* Source/WebCore/page/FocusController.h:
* Source/WebCore/page/FocusControllerTypes.h:
* Source/WebCore/page/RemoteFrameClient.h:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::findFocusableElementDescendingIntoRemoteFrame):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::findFocusableElementDescendingIntoRemoteFrame):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::findFocusableElementDescendingIntoRemoteFrame):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FocusWebView.mm:

Canonical link: https://commits.webkit.org/306434@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to