Skip to content

feat(core): Extract text from children of touched components for breadcrumb labels#6106

Open
antonis wants to merge 7 commits intomainfrom
antonis/issue-6097
Open

feat(core): Extract text from children of touched components for breadcrumb labels#6106
antonis wants to merge 7 commits intomainfrom
antonis/issue-6097

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented May 7, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Walks the React fiber tree downward (child/sibling pointers) to extract text content from children of touched components. This text is used as a lowest-priority label fallback when no explicit label (sentry-label, custom labelKey) is set.

For example, a button like:

<TouchableOpacity onPress={save}>
  <Text>Save workout</Text>
</TouchableOpacity>

will now produce a breadcrumb with label "Save workout" instead of just "TouchableOpacity".

Masking behavior

  • When maskAllText is enabled (the default for replay users): text extraction is automatically disabled to avoid leaking masked content via breadcrumbs. No behavior change for these users.
  • When maskAllText is explicitly false: text extraction is enabled.
  • When MobileReplay integration is not installed: text extraction is enabled. This is a behavior change — users without replay will now see text labels in their touch breadcrumbs where previously they only saw component names. This can surface new data in breadcrumbs (component text content). Users can opt out via extractTextFromChildren: false on TouchEventBoundary.
  • Per-view Sentry.Mask boundaries are respected: text inside <Sentry.Mask> is never extracted.

Safety limits

  • Max text length: 64 characters (truncated with ...)
  • Max depth: 3 levels of child traversal
  • Max siblings: 5 per level (prevents runaway traversal in long lists)

New prop

extractTextFromChildren (default true) — set to false to opt out entirely.

Label priority (lowest to highest)

  1. Extracted text children ← new
  2. Custom labelKey prop value
  3. sentry-label prop

💡 Motivation and Context

Touch breadcrumbs currently produce unhelpful labels like "Touch event within element: View" which makes Session Replay AI summaries and issue debugging less useful. This change automatically extracts meaningful labels from component text content.

Closes #6097

💚 How did you test it?

  • 11 new unit tests covering: basic extraction, nested children, siblings, truncation, masking gate (maskAllText: true, false, undefined), Sentry.Mask boundary, priority over extracted text, extractTextFromChildren: false opt-out, raw text fiber nodes, integration without options
  • All 31 touchevents tests pass
  • Type check passes (no new TS errors)
  • Lint passes (0 warnings, 0 errors)

📝 Checklist

🔮 Next steps

antonis and others added 2 commits May 7, 2026 10:57
…dcrumb labels

Walks the React fiber tree downward (child/sibling) to extract text content
from touched components as a lowest-priority label fallback. Gated on Session
Replay's maskAllText setting and respects per-view Sentry.Mask boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(core): Extract text from children of touched components for breadcrumb labels by antonis in #6106
  • feat(core): Use accessibilityLabel, aria-label, and testID as touch breadcrumb label fallbacks by antonis in #6103
  • perf(android): Replace RNSentryFrameDelayCollector with sentry-java getFramesDelay API by antonis in #6074
  • chore(deps): update Android SDK to v8.41.0 by github-actions in #6104
  • chore(deps): update Cocoa SDK to v9.12.1 by github-actions in #6105
  • build(core): Add public API surface tracking with api-extractor by antonis in #6093
  • chore(deps): bump axios from 1.15.0 to 1.16.0 by dependabot in #6091
  • ci: Add workflow to notify issues when fix is released by antonis in #6089
  • ci: Add Danger check to warn about auth token handling changes by antonis in #6087
  • Fix PNPM iOS Upload Debug Symbol fail in EAS Build by alwx in #6086
  • chore(deps): update Sentry Android Gradle Plugin to v6.6.0 by github-actions in #6085
  • fix(e2e): Remove flaky iOS replay assertion from captureReplay test by antonis in #6072
  • chore(deps): bump github/codeql-action from 4.35.2 to 4.35.3 by dependabot in #6078
  • fix: Prevent shell injection vulnerability in GitHub Actions workflow by fix-it-felix-sentry in #6077
  • chore(deps): update Maestro to v2.5.1 by github-actions in #6075

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against f869a74

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonis
Copy link
Copy Markdown
Contributor Author

antonis commented May 7, 2026

@sentry review

@antonis
Copy link
Copy Markdown
Contributor Author

antonis commented May 7, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f93f818. Configure here.

Comment thread packages/core/src/js/touchevents.tsx
antonis and others added 4 commits May 7, 2026 11:43
…raction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The prop defaults to true but effective behavior depends on maskAllText,
which defaults to true in mobileReplayIntegration, disabling extraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonis antonis marked this pull request as ready for review May 7, 2026 11:05
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.

Extract text children from touchable components for breadcrumb labels

1 participant