Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestWebKitAPI.KeyboardInputTests.EditableWebViewRequiresKeyboardWhenF…
…irstResponder fails on iPhone Simulator https://bugs.webkit.org/show_bug.cgi?id=273737 rdar://127547640 Reviewed by Abrar Rahman Protyasha and Megan Gardner. Prior to BrowserEngineKit adoption, WebKit would use UIKit SPI (`-[UIPressesEvent _hidEvent]`) to keep track of when a hardware keyboard key is pressed; when observed, we'd then set a boolean flag, `_seenHardwareKeyDownInNonEditableElement`, which allows us to then return YES from `-_requiresKeyboardWhenFirstResponder`. This is crucial for key event compatibility, in the case where the web page listens for key events outside of the context of editing, and the user is using a hardware keyboard on iOS (and can therefore dispatch keyboard events without the help of a software keyboard). With BrowserEngineKit adoption, we no longer rely on the aforementioned SPI; UIKit instead automatically returns `YES`, as long as `-hardwareKeyboardAttached` is set. However, because this is set by default when running tests in the iOS simulator, `-_requiresKeyboardWhenFirstResponder` now returns `YES` right after loading the test markup. Account for this change in the test by swizzling out `-hardwareKeyboardAttached` to simulate the keyboard being detached, when running this test. * Tools/TestRunnerShared/spi/UIKitSPIForTesting.h: * Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: (TestWebKitAPI::overrideHardwareKeyboardAttached): (TestWebKitAPI::TEST(KeyboardInputTests, EditableWebViewRequiresKeyboardWhenFirstResponder)): Canonical link: https://commits.webkit.org/278427@main
- Loading branch information