Skip to content

fix(capture-kit): keep react-native dismiss-overlay off app Close and Dismiss buttons - #5013

Merged
thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/rn-dismiss-overlay-controls
Nov 23, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/rn-dismiss-overlay-controls

Conversation

@imranbarbhuiya

@imranbarbhuiya imranbarbhuiya commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

react-native dismiss-overlay treated any Dismiss, Close or × node as the overlay's control and ranked semantic buttons first, so an app's own [button] "Close" or [button] "Dismiss" beat LogBox's [other] "Dismiss".

The only control taken is now the footer Dismiss of LogBox's inspector or of RedBox. Both footers give each control an equal column across one row, so Dismiss and its Minimize, Reload, Copy or Extra Info partners sit centered at an even spacing. The row meets the surface edges, or stops short by at most a landscape side inset (80 dp); without a surface it needs three columns. The tap goes to Dismiss's column, however the capture lists the footer, trying candidates from the capture's end.

Otherwise the collapsed banner is closed at its own affordance, except while the inspector's Dismiss and Minimize share a row. Role, hittable and area no longer rank anything.

Before / after

iPhone 17 Pro simulator (iOS 27.2), examples/test-app patched with an app [button] "Close" and [button] "Dismiss" and a console.error on mount. Base runs swap in the base overlay module.

$ react-native dismiss-overlay --json   # portrait, collapsed banner
base aecafaf30: overlayAction "close" on the app's Close (55, 253), verified false
head c3767afa4: overlayAction "close-collapsed-banner" (369, 813), verified true

$ react-native dismiss-overlay --json   # portrait, inspector opened from the banner
base aecafaf30: overlayAction "close" on the app's Close (55, 253), verified false
head c3767afa4: overlayAction "dismiss" in the footer's Dismiss column (67, 833), verified true

$ react-native dismiss-overlay --json   # landscape, inspector opened from the banner
base aecafaf30: overlayAction "close" on the app's Close (94, 144), verified false
head c3767afa4: overlayAction "dismiss" in the footer's Dismiss column (146, 368), verified true

Validation

  • Head 38ae926da, check:affected --run --head, exactCommit: true: format, lint, typecheck, layering, fallow, build and vitest-related pass.
  • Device runs at c3767afa4; 38ae926da picks the same node and point in those captures.
  • 33 new unit tests, 32 failing at base. Five handler fixtures gain a surface and an evenly spaced footer; four banner fixtures close at the banner's affordance.
  • 38 mutants on the new guards each fail a test; two more are equivalent.

@thymikee

Copy link
Copy Markdown
Member

Thanks for tackling the Close-button tap.

At c760aca, dismiss-overlay can still tap an app's own Dismiss button, so the bug is not fully fixed yet. In resolveSafeDismissAction, overlay evidence only ranks Dismiss candidates. It is never a precondition. Take an app [button] 'Dismiss' (a toast or banner button) plus a collapsed LogBox banner with no Dismiss-labelled child, the shape your collapsedBanner fixture uses. Detection is true, the app button is the only Dismiss candidate (score 0 but non-null), and the function returns dismiss on it. It never reaches the close and collapsed-banner branches. The app's Dismiss is tapped, the banner stays, and the command reports that an overlay is still detected. This is the collapsed warning banner, the most common LogBox state, with any app Dismiss on screen. Base behaves the same, so this is not a regression, but it is the stated bug for the Dismiss label. Please make overlay evidence a gate for every candidate: keep a Dismiss or Close candidate only when it is on the overlay surface or shares the footer row, and otherwise fall through to the banner fallback or to "detected, no safe target". Please add tests for an app Dismiss with collapsedBanner (expect close-collapsed-banner) and for an app Dismiss with only a Call Stack text (expect no primary action).

The footer-row signal is also not scoped to the overlay, which likely lets the same wrong tap happen with the expanded inspector open. footerControlNodes collects every node on screen labelled Minimize, Reload, Reload JS or Copy, and sharesFooterRow counts any vertical overlap with any of them. An app row with its own Reload and Dismiss buttons, or a media player with Minimize, gives the app Dismiss the same boosted score as LogBox's footer Dismiss. Ties then fall to role, hittable and area, where an app [button] beats the inspector's [other]. Please derive footer evidence from the overlay itself, so one predicate, "this node belongs to the overlay", owns both the surface and footer evidence, and add a test with an app Reload + Dismiss row beside the LogBox footer.

Could the score become a gate? Candidates would be Dismiss and Close controls on an overlay surface, meaning the inspector footer or an evidence banner. No candidate would lead to the banner coordinate fallback and then to "detected, no safe target". That looks like the same line count and no new contract. It would drop the role, hittable and area ranking over unrelated app buttons, and the footer and surface evidence would become one predicate. Is there a reason to keep the ranking for the Dismiss branch?

Not blocking, and fine to take or leave: the new tests never reach the case where the only Dismiss is the app's, which is why the first problem passes the suite. overlaySurfaceNodes also admits app text such as Call Stack or Runtime error as a surface, so a Close inside such an app container could become a target. The live run (iOS simulator, collapsed banner, app Close) was taken on an earlier head and does not cover the expanded inspector, Android, or an app Dismiss.

Checks at this head: unit and coverage jobs are green. The Smoke Tests Linux job fails in Install Linux desktop dependencies with an apt-get update timeout before any test runs, which looks unrelated to this diff. The other Smoke jobs pass, and the Body rules run at this head passes. No conflicts.

Not verified here: the PR head was not executed, and the findings above come from reading the code and the PR's own fixtures. The 3/3 base-versus-head device claim rests on the PR-body transcript, and real LogBox and RedBox accessibility shapes (including Android) were taken from the fixtures.

Before merge, the Dismiss branch must be gated on overlay evidence and the footer signal scoped to the overlay, with tests for both. After that, please run on the final head with an app Close and an app Dismiss on screen. First, the collapsed banner should give overlayAction close-collapsed-banner with verified true. Second, the expanded inspector opened by tapping the banner should give dismiss on the inspector's footer Dismiss ref with verified true. Please post the refs and the JSON output.

…tons

dismiss-overlay took any node labelled Close or a close glyph as the overlay's
dismiss control and ranked semantic buttons first. An app's own [button] "Close"
therefore beat LogBox's [other] "Dismiss" in the expanded inspector and
suppressed the collapsed-banner fallback, so the command tapped app UI and
then reported that the overlay was still detected. An app's [button] "Dismiss"
beat LogBox's footer Dismiss the same way.

Overlay evidence now outranks role. A Dismiss that shares its row with LogBox's
Minimize or RedBox's Reload/Copy, or sits on an overlay surface, wins over one
that does not. A generic close label counts only on an overlay surface: a
descendant of, or fully inside, a collapsed warning banner with LogBox
evidence, or a non-full-screen node whose own text names LogBox/RedBox. The
collapsed-banner coordinate fallback keeps its stricter safety filter.
…erlay

Overlay evidence ranked Dismiss and Close candidates but never gated
them, and the evidence itself came from app-shaped facts: any Minimize,
Reload or Copy in the same row, any node whose text named LogBox, and
any control inside a banner's frame although LogBox floats over app
content.

The only control taken is now the footer Dismiss of LogBox's inspector
or of RedBox. Both footers give each control an equal column across one
row, so Dismiss and its Minimize, Reload, Copy or Extra Info partners
sit centered at an even spacing, and the row meets the surface edges,
or stops short by at most a landscape side inset (80 dp). Without a
surface, a footer needs three or more columns. The target is Dismiss's
column, whether the capture lists the full tile, only its text, or a
row it folded the Dismiss tile into (the iOS simulator accessibility
capture labels the footer row Dismiss and nests the other tiles inside
it, so the row's center is Minimize).

Otherwise the collapsed banner is closed at its own affordance, except
while the inspector's Dismiss and Minimize share a row, when the banner
lies under the inspector. Role, hittable and area no longer rank
anything, and the unused 'close' action is gone. Handler fixtures for
the inspector and RedBox now carry a surface and an evenly spaced
footer; the banner fixtures use a LogBox evidence label.
@imranbarbhuiya
imranbarbhuiya force-pushed the fix/rn-dismiss-overlay-controls branch from c760aca to c3767af Compare November 23, 2026 15:28
@imranbarbhuiya imranbarbhuiya changed the title fix(capture-kit): keep react-native dismiss-overlay off app Close buttons fix(capture-kit): keep react-native dismiss-overlay off app Close and Dismiss buttons Nov 23, 2026
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author

Thanks. Reworked in c3767af, rebased on main.

  • Overlay evidence is now a gate. The only control taken is the footer Dismiss of LogBox's inspector or RedBox. It must sit in one row with its Minimize, Reload, Copy or Extra Info partners at an even column spacing, with the columns derived from the row. The row meets the surface edges, or stops short by at most 80 dp in landscape: iOS wraps each footer button in a SafeAreaView, and Android's LogBoxDialog and RedBoxDialogSurfaceDelegate margin the root by the system-bar and cutout insets. Without a surface (macOS) it needs three columns. With no footer, the banner coordinate fallback runs, then "detected, no safe target".
  • Banner-held controls and text surfaces are gone, since the real banner exposes no labelled close and an app control can sit inside its frame. Call Stack or Runtime error text no longer counts, and the unused close action is dropped.
  • While the inspector's Dismiss and Minimize share a row, the banner is never the fallback.

Your three cases are tests (close-collapsed-banner; no primary action; the footer Dismiss), along with app controls under the banner, inset and landscape button pairs, Android text-only and inset footers, RedBox's footer, and no-surface footers. That makes 32 new tests, 31 of them failing at base, and 36 mutants on the new guards each fail one.

On your question: no, I found no reason to keep the ranking, so the gate replaces it. Among nodes labelled Dismiss, one centered in its own column is taken before a folded row, so the ref names the button rather than a wrapper.

Known limits: a full-width app bar with exactly these labels in equal columns still reads as a footer, and a RedBox with extra custom buttons falls back to "no safe target".

Device runs on c3767afa4, iPhone 17 Pro simulator (iOS 27.2). examples/test-app was patched locally with an app [button] "Close" and [button] "Dismiss" on Home and a console.error on mount. snapshot -i and the command's own capture number refs separately, so the JSON ref differs from the snapshot -i ref. I trimmed the gesture timing fields from the JSON.

  1. Portrait, collapsed banner. snapshot -i: app Close @e7, app Dismiss @e8, banner @e32.
$ agent-device react-native dismiss-overlay --json
{
  "success": true,
  "data": {
    "referenceWidth": 402,
    "referenceHeight": 874,
    "x": 369,
    "y": 813,
    "message": "React Native overlay dismiss action sent and verified gone",
    "action": "dismiss-overlay",
    "overlayAction": "close-collapsed-banner",
    "ref": "e37",
    "label": "!, agent-device overlay check",
    "dismissed": true,
    "verified": true,
    "verificationRequired": false
  }
}
  1. Portrait, inspector opened with press @e32. snapshot -i: footer Dismiss @e29, Minimize @e30 and Copy @e31, app Close @e37, app Dismiss @e38. e65 is the footer row the command's capture labels Dismiss, and the tap lands in its Dismiss column.
$ agent-device react-native dismiss-overlay --json
{
  "success": true,
  "data": {
    "referenceWidth": 402,
    "referenceHeight": 874,
    "x": 67,
    "y": 833,
    "message": "React Native overlay dismiss action sent and verified gone",
    "action": "dismiss-overlay",
    "overlayAction": "dismiss",
    "ref": "e65",
    "label": "Dismiss",
    "dismissed": true,
    "verified": true,
    "verificationRequired": false
  }
}
  1. Landscape (orientation landscape-left), inspector opened with press @e22. snapshot -i: footer Dismiss @e16 (62..291), Minimize @e17 and Copy @e18, app Close @e24, app Dismiss @e25.
$ agent-device react-native dismiss-overlay --json
{
  "success": true,
  "data": {
    "referenceWidth": 874,
    "referenceHeight": 402,
    "x": 146,
    "y": 368,
    "message": "React Native overlay dismiss action sent and verified gone",
    "action": "dismiss-overlay",
    "overlayAction": "dismiss",
    "ref": "e42",
    "label": "Dismiss",
    "dismissed": true,
    "verified": true,
    "verificationRequired": false
  }
}

With the base overlay module (aecafaf30) in the same build, all three runs tap the app's Close and report verified: false.

In landscape, the collapsed banner is not detected at base or head. The command's capture puts the banner label on a full-screen 874x402 node, and the collapsed-warning wrapper rule expects a height of at least 600. That is a separate detection gap, left out of this PR.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the quick follow-up. This PR is ready: both high-priority findings from the earlier review are fixed at c3767af, with tests and live iOS simulator runs. Only the Body rules check is not passing, and it was cancelled rather than failed. It checks the PR body format and this diff does not touch it, so it likely needs a re-run. The other 15 checks pass, and there are no conflicts.

Not blocking, and fine to take or leave: footer membership is inferred from geometry (label vocabulary plus equal columns flush with the surface edges), not from overlay ownership, so a full-width app bar with equal columns labelled Dismiss and Copy/Reload/Minimize could match first in capture order (https://github.com/callstack/agent-device/blob/c3767af/packages/capture-kit/src/react-native-overlay.ts#L307). Preferring the last passing footer in capture order would reduce that risk now, and a follow-up issue could derive membership from the LogBox/RedBox container once the capture exposes window or subtree ancestry.

Not verified here: execution of the PR head, the author-reported base-failing test count and mutation results, the Android LogBoxDialog/RedBox footer geometry (it rests on synthetic fixtures, so a real Android capture that misses the 2 dp portrait edge check would now return no target), and the real accessibility shapes of LogBox and RedBox.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
Footer membership is read from geometry, so a full-width app bar with
equal columns labelled Dismiss and Copy, Reload or Minimize can match.
The simulator accessibility capture lists the LogBox and RedBox windows
after the app's, so the candidates are now tried from the end of the
capture and the real footer wins there. A row is listed before the
tiles it holds, so a tile, or its text, is still taken before the row
folded around it.
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Done in 38ae926: footer candidates are tried from the end of the capture. The simulator accessibility capture lists the LogBox and RedBox windows after the app's, so an app bar shaped like a footer loses to the real one there. A tile or its text is still taken before the row folded around it. The XCTest capture lists the overlay first, so this narrows the case rather than closing it. Deriving membership from the LogBox or RedBox container is left to a follow-up issue.
  • Left as is: the 2 dp portrait edge. LogBoxDialog and RedBoxDialogSurfaceDelegate margin the root only by system-bar and cutout insets, which have no side component in portrait. LogBox's flex: 1 buttons and RedBox's equal-weight buttons keep symmetric columns, and Yoga snaps edges to whole pixels. The reconstructed edge is therefore within about 1 px, against 2 dp (5.25 px at 420 dpi).

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the follow-up. The reorder in 38ae926 keeps the footer gate intact, and it raises no new problems compared with the earlier review (c3767af). All 14 checks pass at 38ae926, and nothing else needs to happen before merge.

Not verified here: the PR head was not executed, and this review comes from reading the code and tests. The live iOS simulator runs (collapsed banner, portrait and landscape inspector) were taken at c3767af. In those runs the chosen candidate was the only one passing the gate, so the reorder cannot change those outcomes. The capture-order claims (simulator AX overlay last, XCTest overlay first) are also unverified. If XCTest lists the overlay first, a footer-shaped app bar under the inspector can now win where c3767af picked the real footer. That is the known geometry limit, and main already ranked app controls in that case, so it is not a regression. The follow-up on container-derived membership can close it. The Android LogBoxDialog and RedBox footer geometry rests on synthetic fixtures.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
@thymikee
thymikee merged commit e02daf0 into callstack:main Nov 23, 2026
14 checks passed
@imranbarbhuiya
imranbarbhuiya deleted the fix/rn-dismiss-overlay-controls branch November 23, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants