WKWebView + Bluetooth Keyboard: Ctrl+Home / Ctrl+End causes app crash after input blur (iPadOS 18.4.1 / 18.6.2)

1. Summary

In a hybrid iOS app using WKWebView (Angular + Capacitor), after programmatically blurring an <input> element and connecting a Bluetooth keyboard, pressing Ctrl+Home or Ctrl+End causes the app to crash. The crash stack shows the issue occurs inside UIKit keyboard handling (UITextInteractionSelectableInputDelegate _moveToStartOfLine), indicating a system-level bug.

2. Steps to Reproduce

  1. Open the hybrid app containing a WKWebView.
  2. Blur the input (programmatically).
  3. Connect a Bluetooth keyboard.
  4. Press Ctrl + Home or Ctrl + End.

Expected result:

  • No crash. The command should be ignored if no text input is active.

Actual result:

  • App crashes immediately.

3. Crash Log (Crashlytics Trace)

Crashed: com.apple.main-thread
0  WebKit                         0xfbdad0 <redacted> + 236
1  UIKitCore                      0x10b0548 -[UITextInteractionSelectableInputDelegate _moveToStartOfLine:withHistory:] + 96
2  UIKitCore                      0xd0fb38 -[UIKBInputDelegateManager _moveToStartOfLine:withHistory:] + 188
3  UIKitCore                      0xa16174 __158-[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:]_block_invoke + 52
4  UIKitCore                      0xa36ae4 -[_UIKeyboardStateManager performBlockWithTextInputChangesIgnoredForNonMacOS:] + 48
5  UIKitCore                      0xa160f0 -[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:] + 440
6  UIKitCore                      0xa06614 -[_UIKeyboardStateManager handleKeyCommand:repeatOkay:options:] + 3204
7  UIKitCore                      0xa2fb64 -[_UIKeyboardStateManager _handleKeyCommandCommon:options:] + 76
8  UIKitCore                      0xa2fb08 -[_UIKeyboardStateManager _handleKeyCommand:] + 20
9  UIKitCore                      0xa30684 -[_UIKeyboardStateManager handleKeyEvent:executionContext:] + 2464
10 UIKitCore                      0xa2f95c __42-[_UIKeyboardStateManager handleKeyEvent:]_block_invoke + 40
11 UIKitCore                      0x4b9460 -[UIKeyboardTaskEntry execute:] + 208
12 UIKitCore                      0x4b92f4 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 356
13 UIKitCore                      0x4b8be0 -[UIKeyboardTaskQueue addTask:breadcrumb:] + 120
14 UIKitCore                      0xa2f8d0 -[_UIKeyboardStateManager handleKeyEvent:] + 432
15 CoreFoundation                 0x2f934 __invoking___ + 148
16 CoreFoundation                 0x2efac -[NSInvocation invoke] + 424
17 UIKitCore                      0x14cbcc4 -[UIRepeatedAction invoke] + 176
18 UIKitCore                      0x14cbeb8 -[UIRepeatedAction _preInvocationTimerFire] + 56
19 UIKitCore                      0x1195364 -[UIApplication _handleKeyboardPressEvent:] + 2192
20 UIKitCore                      0x1187278 -[UIApplication pressesBegan:withEvent:] + 328
21 UIKitCore                      0x9b808 forwardTouchMethod + 376
22 UIKitCore                      0x9b808 forwardTouchMethod + 376
23 UIKitCore                      0x9b808 forwardTouchMethod + 376
24 UIKitCore                      0x9b808 forwardTouchMethod + 376
25 UIKitCore                      0x9b808 forwardTouchMethod + 376
26 UIKitCore                      0x9b808 forwardTouchMethod + 376
27 UIKitCore                      0x9b808 forwardTouchMethod + 376
28 UIKitCore                      0x9b808 forwardTouchMethod + 376
29 WebKit                         0x66e2b4 <redacted> + 84
30 UIKitCore                      0x9b808 forwardTouchMethod + 376
31 UIKitCore                      0x157290c -[UIScrollView pressesBegan:withEvent:] + 148
32 UIKitCore                      0x9b808 forwardTouchMethod + 376
33 WebKit                         0xfbbd04 <redacted> + 100
34 UIKitCore                      0x11a7620 -[UIWindow _sendButtonsForEvent:] + 312
35 UIKitCore                      0x522dc -[UIWindow sendEvent:] + 568
36 UIKitCore                      0x5f508 -[UIApplication sendEvent:] + 376
37 UIKitCore                      0x1194364 -[UIApplication _handleKeyUIEvent:] + 136
38 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
39 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
40 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
41 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
42 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
43 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
44 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
45 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
46 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
47 UIKitCore                      0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
48 UIKitCore                      0x11943e8 -[UIApplication handleKeyUIEvent:] + 56
49 UIKitCore                      0x11942ac -[UIApplication _handleKeyHIDEvent:usingSyntheticEvent:] + 660
50 UIKitCore                      0x117ac __dispatchPreprocessedEventFromEventQueue + 4648
51 UIKitCore                      0xfbe4 __processEventQueue + 4812
52 UIKitCore                      0x94e4 updateCycleEntry + 160
53 UIKitCore                      0x9404 _UIUpdateSequenceRun + 84
54 UIKitCore                      0x8ab4 schedulerStepScheduledMainSection + 208
55 UIKitCore                      0x41e4 runloopSourceCallback + 92
56 CoreFoundation                 0xf92c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
57 CoreFoundation                 0xf744 __CFRunLoopDoSource0 + 172
58 CoreFoundation                 0xf5a0 __CFRunLoopDoSources0 + 232
59 CoreFoundation                 0xff20 __CFRunLoopRun + 840
60 CoreFoundation                 0x11adc CFRunLoopRunSpecific + 572
61 GraphicsServices               0x1454 GSEventRunModal + 168
62 UIKitCore                      0x135274 -[UIApplication _run] + 816
63 UIKitCore                      0x100a28 UIApplicationMain + 336
64 Order                          0xa2ed0 main + 21 (AppDelegate.swift:21)

4. Environment

  • iPadOS versions: 18.1.0, 18.4.1, 18.6.2
  • WebView: WKWebView
  • Hybrid stack: Angular + (Capacitor)
  • Reproducible on multiple iPads and multiple iPadOS 18.x versions.

5. Expected Behavior

Pressing Ctrl+Home or Ctrl+End when no text input is active should be ignored and should not crash the app.

6.Key Code Snippet swift:

import UIKit
import WebKit
 
final class ViewController: UIViewController {
 
    private var webView: WKWebView!
 
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        let config = WKWebViewConfiguration()
        webView = WKWebView(frame: view.bounds, configuration: config)
        view.addSubview(webView)
        loadRemotePage()
    }
 
    private func loadRemotePage() {
        let urlString = "https://.../index.html"
        guard let url = 
       URL(string: urlString) else { return }
        let request = URLRequest(url: url)
        webView.load(request)
    }
}

angular:

export class PageBComponent {
  @ViewChild('inputRef') inputRef!:
     ElementRef<HTMLInputElement>;

  constructor(private cdr: 
     ChangeDetectorRef) {}

  ngAfterViewInit() {
    setTimeout(() => {
      this.inputRef.nativeElement.focus();
    }, 100);
  }
}
WKWebView &#43; Bluetooth Keyboard: Ctrl&#43;Home / Ctrl&#43;End causes app crash after input blur (iPadOS 18.4.1 / 18.6.2)
 
 
Q