Repository navigation
feat: clear key in device.io.keys sends the HID keyboard clear to wipe the focused text field - #101
Merged
Merged
Conversation
…e the focused text field
…or raw HID events
This was referenced Oct 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Clearing a text field with
cmd+a+backspaceis unreliable with the 0.0.33 runner (built with Xcode 26.4). Right after a field gets focus, the firsttypeKeycombo is dropped, so onlybackspacearrives and one character is deleted. This breaks Mobilewright'slocator.fill()/locator.clear()on fields that already have text ("Glorpax" → "Glorpa"). The same runner code built with Xcode 27.1 deliverscmd+afine, so the bug looks tied to the older XCTest frameworks rather than to iOS.What
device.io.keysaccepts a new key name,clear(no modifiers). It sends the HID "Keyboard Clear" key (page0x07, usage0x9C) throughXCUIDevice performDeviceEvent:error:, which wipes the focused text field in one event. It doesn't go throughtypeKey, so it isn't affected by the dropped first combo. This is the same approach WebDriverAgent uses as the first step offb_clearTextWithError(appium/appium#19389).The event is sent by a new generic helper,
sendHIDEvent(page:usage:duration:)inDeviceKitTests/XCTest/HIDEvent.swift, so other raw HID usages can reuse it.XCDeviceEventandperformDeviceEvent:error:are private and take primitive arguments, so both are looked up at runtime and called through their IMPs. Failures to find or send the event are reported asinternalError.Test plan
TextFieldwith text:clearright after tapping the field empties itclearafter typing into the field empties itclearempties itclearempties the focused field