Skip to content

INP metric: Too many spans with <unknown> target due to disappearing DOM elements #18409

Open

Description

@dariusz-biela

Problem Statement

We are seeing a large number of INP-related spans where the clicked element is reported as <unknown>.
This happens when the user clicks UI elements that immediately disappear from the DOM right after the interaction — most commonly:

  • closing buttons (e.g., closing a modal),
  • clearing input with an “X” button,
  • removing items from lists, cards, etc.

Because these elements are removed, by the time Sentry processes the INP event, e.target is already null, which results in spans showing <unknown> instead of the actual clicked element.
This significantly reduces the usefulness and traceability of INP measurements.

Solution Brainstorm

A potential fix is to capture and cache metadata about the clicked element at the moment of the click event — before the element disappears.

Example approach:

  1. On click, immediately compute and store the result of htmlTreeAsString(event.target) (or an equivalent helper used for INP).
  2. When constructing INP spans, use the cached htmlTreeAsString value instead of trying to read event.target again (which may already be null after DOM removal).

Product Area

Unknown

Activity

  1. linear commented on Nov 28, 2025

    @linear
  2. getsantry commented on Nov 28, 2025

    @getsantry

    Assigning to @getsentry/support for routing ⏲️

  3. moved this to Waiting for: Support in GitHub Issues with 👀 3on Nov 28, 2025
  4. getsantry commented on Dec 1, 2025

    @getsantry

    Routing to @getsentry/product-owners-insights for triage ⏲️

  5. moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3on Dec 1, 2025
  6. transferred this issue fromgetsentry/sentryon Dec 4, 2025
  7. linear commented on Dec 4, 2025

    @linear
  8. logaretm commented on Dec 5, 2025

    @logaretm
    Member

    What is the SDK version used here? We shipped a fix in 10.23.0 that should reduce the number of these elements considerably as we observed it on our own end.

  9. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Dec 5, 2025
  10. dariusz-biela commented on Dec 5, 2025

    @dariusz-biela
    Author

    What is the SDK version used here? We shipped a fix in 10.23.0 that should reduce the number of these elements considerably as we observed it on our own end.

    • @sentry/react-native: 7.7.0
    • @sentry/core: 10.26.0
    • @sentry/browser: 10.26.0
    • @sentry/react: 10.26.0
    • @sentry/webpack-plugin: 4.6.0

    In our project: over the last 14 days, approximately 50% of the traces named ui.interaction.click have the span.description value set to <unknown>.

  11. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Dec 5, 2025
  12. logaretm commented on Dec 5, 2025

    @logaretm
    Member

    Perhaps the timing window we limit for the elements cache is a bit aggressive, I will see about increasing it and observing the results.

  13. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Dec 5, 2025
  14. logaretm commented on Jan 27, 2026

    @logaretm
    Member

    I circled back to this and the webvitals and the chrome team are working on a string targetSelector to include in the timing events for the performance entries.

    https://chromestatus.com/feature/5143499213242368
    w3c/event-timing#160

    which should make it really easy for us to avoid sliding timing windows that may mismatch elements with their events.

    There is a tracking issue in the webvitals upstream GoogleChrome/web-vitals#673 and I will keep watch once it goes live to see if we can enable it for newer chrome releases and see how well it works.

  15. self-assigned this
    on Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions