Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4a2997b2136afe89e5f98a5730c3de81e3992d93
https://github.com/WebKit/WebKit/commit/4a2997b2136afe89e5f98a5730c3de81e3992d93
Author: Simon Pena <[email protected]>
Date: 2026-10-08 (Thu, 08 Oct 2026)
Changed paths:
M Source/WebCore/history/CachedPage.cpp
M Source/WebCore/page/FocusController.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp
Log Message:
-----------
[GTK][WPE] Input method stays off after going back to a page with a focused
field
https://bugs.webkit.org/show_bug.cgi?id=325995
Reviewed by Adrian Perez de Castro.
When a page is restored from the back/forward cache, its focused element comes
back, but the input
method is not told. The UI process got a null input method state when the page
was left, and
nothing after the restore. Typing then goes past the input method until the
field is blurred and
focused again.
Tapping the field does not help either. The element is already focused, so
FocusController::setFocusedElement() returns early and does not update the
input method state.
Send the input method state for the focused element in CachedPage::restore().
The restore is not a
user interaction, so the state has the InhibitOnScreenKeyboard hint and the
keyboard does not open
by itself. iOS also drops the focused element when the page commits and does
not bring it back on
restore.
Also send the state when a click focuses an element that is already focused.
After a tap, the
state no longer has the InhibitOnScreenKeyboard hint. Only clicks do this:
selection changes also
focus the already focused element again, and they must not add or remove the
hint.
setInputMethodState() does nothing outside GTK and WPE.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp
* Source/WebCore/history/CachedPage.cpp:
(WebCore::CachedPage::restore):
* Source/WebCore/page/FocusController.cpp:
(WebCore::FocusController::setFocusedElement):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp:
(serverCallback):
(testWebKitInputMethodContextFocusBackForwardCache):
(testWebKitInputMethodContextClickAfterScriptFocus):
(testWebKitInputMethodContextBackForwardCacheWithoutFocus):
(beforeAll):
(afterAll):
Canonical link: https://commits.webkit.org/323080@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications