Skip to content

fix(ios): say when described coordinates are not the ones taps use - #694

Open
filip131311 wants to merge 1 commit into
mainfrom
filip/ios-orientation-advisory
Open

fix(ios): say when described coordinates are not the ones taps use#694
filip131311 wants to merge 1 commit into
mainfrom
filip/ios-orientation-advisory

Conversation

@filip131311

Copy link
Copy Markdown
Collaborator

The iOS half of #609. Companion to #693, which fixes the Android half; the two are independent.

What was wrong

On a rotated iOS simulator argent reports coordinates in two different spaces depending on which path served the tree, and says nothing about it.

Measured on a landscape iPad Pro 13-inch, the same button:

path coordinates do taps land there?
describe via ax-service (0.238, 0.342) yes
describe via native-devtools fallback (0.342, 0.762) no
native-describe-screen (0.342, 0.762) no

The two are related by ax.x = 1 - native.y, ax.y = native.x — a 90° rotation. native-describe-screen reports screenFrame: {width: 1376, height: 1032} — landscape — because it measures against the app's own screen, which follows rotation. Touch input does not.

So native-describe-screen documents normalizedFrame / normalizedTapPoint as tap coordinates, and on a rotated device they are not. describe has the same problem whenever the accessibility tree comes back empty and the native fallback serves the tree instead.

Why this warns instead of transforming

The only orientation signal on this path is the screen's aspect, which gives the axis but not the sense. It cannot separate LandscapeLeft from LandscapeRight, and those differ by 180°.

Rotating on a guess would replace a visible mismatch (coordinates that obviously miss) with taps that land somewhere plausible but wrong — much harder to notice, and a worse failure. Until the orientation itself is on the wire, saying so is the honest fix. The numbers are left exactly as they were, and there is a test asserting that.

rotate gets the same warning on iOS, and deliberately does not stop at "pass rotation to screenshot". That advice produces a readable image whose coordinates silently disagree with describe and with touch — which is the trap the issue reports, not a workaround for it. The argent-device-interact skill said exactly that and is corrected here.

Verified live on a rotated iPad Pro 13-inch

rotate LandscapeLeft   -> note returned, warns not to read coordinates off a rotated capture
native-describe-screen -> screenFrame 1376x1032 (landscape) -> hint present
rotate Portrait        -> screenFrame 1032x1376 (upright)   -> hint absent
rotate on Android      -> no iOS note, as intended

Full tool-server suite 3096 passing; lint, prettier, typecheck:tests and the tool-description gate all clean.

Not in scope

Making iOS coordinates consistent. That needs the real orientation — including its sense — from the native side (windowScene.interfaceOrientation), which means an argent-private change plus a prebuilt-binary release. Worth doing, but it is a different PR, and the advisories here are useful whether or not it happens.

On a rotated iOS simulator argent reports coordinates in two different spaces
depending on which path served the tree, and says nothing about it. Measured on
a landscape iPad Pro 13-inch, the same button reads (0.238, 0.342) from the
ax-service tree and (0.342, 0.762) from native-devtools — related by
ax.x = 1 - native.y, ax.y = native.x, a 90 degree rotation.

Touch input is in the unrotated space, so the ax-service numbers hit and the
native-devtools ones miss. `native-describe-screen` documents its normalized
fields as tap coordinates, and on a rotated device they are not. The same is
true of `describe` when the accessibility tree comes back empty and the native
fallback serves the tree instead.

Nothing is transformed. The only orientation signal available on this path is
the screen's aspect, which gives the axis but not the sense — it cannot separate
LandscapeLeft from LandscapeRight, and those are 180 degrees apart. Rotating on
a guess would replace a visible mismatch with taps that land somewhere plausible
but wrong, which is much harder to notice. Until the orientation itself is on
the wire, saying so is the honest fix.

`rotate` now carries the same warning on iOS, and deliberately does not stop at
"pass rotation to screenshot": that yields a readable image whose coordinates
silently disagree with `describe` and with touch, which is the trap the issue
reports rather than a workaround for it.

Refs #609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants