Repository navigation
fix: report keyboard focus from the snapshot's hasKeyboardFocus, so the Email field reports focus too - #104
Merged
Merged
Conversation
…he Email field reports focus too
gmegidish
force-pushed
the
fix/email-field-focus
branch
from
October 15, 2026 20:16
6a204d8 to
3683643
Compare
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.
Problem
After tapping the Email field in Milliways' Edit Profile screen, the field is focused (cursor and email keyboard shown), but
dumpUImarks no element as focused. Display name and Phone work.The dump found the focused element with a separate
hasKeyboardFocus == truequery, then marked the node whose frame was exactly equal. For Email the two frames differ only in floating-point rounding, so nothing matched:Frame matching could also mark two nodes that share a rect, such as a text field and its container.
Fix
Each XCTest snapshot object already carries the private
hasKeyboardFocusproperty.dictionaryRepresentationleaves it out, soelementHierarchynow walks the snapshot objects alongside the built tree and copies it onto the matching node.elementHierarchy(fallbacks, keyboard, alerts, status bars), so they all report focus.responds(to:)before reading the private property, so if a future Xcode drops it, focus just isn't reported and the agent doesn't crash.Test plan
TextFieldas focused, and nothing is focused before any tap.isFocused(Email) andtoBeFocused(Phone) pass.make lintreports no new violations in the changed lines.