[webkit-changes] [WebKit/WebKit] 3315d8: [iOS] Tapping "Done" sometimes fails to dismiss th...

Wenson Hsieh noreply at github.com
Thu May 18 23:20:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3315d8e5237e64de3178a0d200631deb98022c3c
      https://github.com/WebKit/WebKit/commit/3315d8e5237e64de3178a0d200631deb98022c3c
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-05-18 (Thu, 18 May 2023)

  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:
  -----------
  [iOS] Tapping "Done" sometimes fails to dismiss the software keyboard after dismissing AutoFill UI
https://bugs.webkit.org/show_bug.cgi?id=256997
rdar://109413302

Reviewed by Aditya Keerthi.

Make it harder for WebKit SPI clients to accidentally leave the keyboard in a broken state, where
tapping the Done button fails to dismiss the keyboard. This is currently possible in the case where
`-_preserveFocusWithToken:destructively:` is invoked without a balanced call to
`-_restoreFocusWithToken:`, since we'll continue to maintain the `_focusPreservationCount` until
a new element is focused (which resets this count back to 0).

Instead, if the user taps the Done button (which is surfaced to WebKit as a call to
`-accessoryDone`), we should always allow the user to dismiss the keyboard; to ensure this, we add a
call to `-_resetFocusPreservationCount` before attempting to blur the focused element.

Test: FocusPreservationTests.UserCanDismissInputViewRegardlessOfFocusPreservationCount

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _resetFocusPreservationCount]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView accessoryDone]):
(-[WKContentView _elementDidBlur]):
* Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm:

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




More information about the webkit-changes mailing list