fix(mobile): read agent-device's covered mark as hidden
TA
8d ago+1390+1390+0123456789012345678901234567890123456789-75-75-01234567890123456789
What and why
- agent-device marks a node
interactionBlocked: 'covered'when something drawn over it holds its centre. e2e ignored the mark, sotoBeVisiblepassed andscrollUntilVisiblestopped on a field a footer covers (#1324). - Outside the soft keyboard, a covered node now reads as hidden, so
toBeVisiblewaits andscrollUntilVisiblekeeps scrolling. agent-device's refusal of an action on it already fails asACTION_FAILEDthrough thestaleOrbranch from #1686. - Under the keyboard, #1686's keyboard rules decide, since agent-device counts the Android IME as a cover. So a focused field, the keyboard's own nodes, and a container with a child above the keyboard stay visible on Android as on main. "Under the keyboard" uses agent-device's own cover point,
centerOfRect. - On Android, while agent-device reports a keyboard it could not measure (no band), the mark hides nothing, as on main (
keyboardUnplacedinpackages/mobile/src/nodes.ts). iOS is unaffected: agent-device never counts the iOS keyboard as a cover. - Role queries still find a covered node, so
getByRole(...).tap()fails with agent-device's refusal rather than finding nothing. A node the keyboard hides stays out of role queries, as #1686 documents. Role queries and a fill's pre-check read the projected node'splatformHiddenfact (what the platform and the keyboard hide), so a field that turns covered before a fill goes to agent-device's refusal with no retry, as on main. - The keyboard dismissal drag reads the projected node's
coveredfact, from a projection with the same keyboard band an observation gets. A covered leaf no larger than half the screen is an obstacle. Being covered makes no container one, since agent-device tests only a node's centre. The drag starts in a clear scroll view away from covered ones when it can, and else anywhere in a scroll view, covered or not. A button the keyboard half covers still keeps the drag off its visible top, as on main. - The role-query note in
packages/core/src/engine/contract.tsandengine.mdxlets an engine keep a node its driver marks covered; platform- and keyboard-hidden nodes stay out. - The footer case needs two agent-device changes, proposed in callstack/agent-device#4347. Until e2e bumps to them, the Covered Field test and its agentic scenario are declared and skipped with that reason.
On main c30354ff (agent-device 0.21.41).
Issue
Refs #1324
Verified
Ran it locally: yes. Unit tests on main c30354ff plus this branch, with agent-device 0.21.41. Before the rebase, on agent-device 0.21.36: the iOS 26.5 benchmark suite (57 passed) and an iOS 27.2 simulator.
| Run | Keyboard dismissal and fill tests (89: keyboard.test.ts, and the engine's keyboard dismissal and input freshness groups) |
|---|---|
main c30354ff | 6 fail: the new behaviors (a covered leaf blocks the drag, also beside a keyboard narrower than the screen, in keyboardDragStart and through device.dismissKeyboard(); a clear scroll view is preferred; a covered one nested in it is avoided) and the new covered field. The other 83 pass, so in those cases this branch does what main does |
c011913c, the rebase kdy1 reviewed | 10 fail: kdy1's repro through device.dismissKeyboard(), covered scroll views with and without children, the only scroll view covered, a covered card, a clear carousel with no point, a mark under the keyboard, a covered leaf beside a keyboard narrower than the screen, and a fill on a field that turned covered |
ceeafaee | 3 fail: a covered leaf beside a keyboard narrower than the screen, in keyboardDragStart and through device.dismissKeyboard() (the drag started at {195,383}, inside its margin), and the new covered field |
| this branch | all 89 pass, and all 620 in the mobile package |
- 36 bugs planted in the changed lines, this round's and the earlier ones re-run on the new code; all 36 fail a test. That includes the one that survived okwasniewski's run: the keyboard band widened to the full screen width in
keyboardPlacement, for the drag and the observation together, and for each alone. pnpm checkpasses.- The device suites were not re-run after the rebase; CI runs iOS 26.5 and Android. The iOS 27.2 probe from earlier rounds used a false Toolbar mark (callstack/agent-device#4365), which agent-device 0.21.37 fixed (callstack/agent-device#4405), so it no longer applies.
- Android was not run on a device, since no phone is attached here. The Android keyboard cases are unit tests in the shape agent-device's Android capture produces.
- Golden trees: a new iOS 26.5 capture of the Covered Field screen. It has no covered marks yet, because agent-device does not mark the app's footer. I'll re-capture the goldens when callstack/agent-device#4347 ships.
- Left as is: the half-pixel band edge between
underKeyboard(exact centre, from #1686) and the covered check (centerOfRect); not a regression, and happy to align them. - Separate, from #1686: on Android, Gboard's own keys read hidden under the keyboard, because
keyboardSideneeds aKeyboardnode and Android has none. This PR does not change that.
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile. Only the wording of the role-query note incontract.tschanged: no type changed, and the web engine never reports a covered node. So the changeset coverse2e,@e2e-dev/coreand@e2e-dev/mobile, but not@e2e-dev/web. Happy to add it if you want it too.