Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 594434191685038c40d35424ca1d8a78ecbbcab9
https://github.com/WebKit/WebKit/commit/594434191685038c40d35424ca1d8a78ecbbcab9
Author: Wenson Hsieh <[email protected]>
Date: 2026-01-15 (Thu, 15 Jan 2026)
Changed paths:
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm
Log Message:
-----------
REGRESSION (iOS 26): Unable to dismiss software keyboard using Done button
after presenting AutoFill credentials picker
https://bugs.webkit.org/show_bug.cgi?id=305617
rdar://162423793
Reviewed by Abrar Rahman Protyasha.
After the changes in rdar://140125213, Safari AutoFill now invokes
`-_retainActiveFocusedState` with
no corresponding logic to release the state by calling the block, when the user
presents the
credentials picker (i.e. tapping the key icon). This causes active focused
state to leak
indefinitely, preventing the user from ever dismissing the keyboard in that web
view.
This patches hardens WebKit against this type of API (mis)use, by forcibly
resetting the active
focus state count (and logging an error on behalf of the client) in the case
where the keyboard is
being dismissed by the user with a nonzero focus state count.
Test:
FocusPreservationTests.UserCanDismissInputViewRegardlessOfFocusPreservationCount
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _resetFocusPreservationCountAndReleaseActiveFocusState]):
Rename this method, now that it clears out both focus preservation and active
focus state counts.
(-[WKWebView _retainActiveFocusedState]):
Make the callback robust in the case where `_activeFocusedStateRetainCount` is
already 0, which can
occur in this case where the client leaks active focused state retainment and
the user tries to
manually dismiss the keyboard.
(-[WKWebView _resetFocusPreservationCount]): Deleted.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView accessoryViewDone:]):
(-[WKContentView
_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
(-[WKContentView _elementDidBlur]):
* Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm:
(TestWebKitAPI::TEST(FocusPreservationTests,
UserCanDismissInputViewRegardlessOfFocusPreservationCount)):
Tweak an existing test to additionally make sure that leaking
`-_retainActiveFocusedState` won't
cause the software keyboard to become un-dismissable by the user.
Canonical link: https://commits.webkit.org/305694@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications