Skip to content

Conversation

@LeoMcA
Copy link

@LeoMcA LeoMcA commented Sep 11, 2025

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1988206
Relates to mdn/fred#752

Uses composedPath() to get the original target within a Shadow DOM, rather than the custom element with a Shadow DOM itself (which is what event.target is).

This should possibly be considered a breaking change: if clients have patched this themselves, by firing GleanMetrics.recordElementClick(); for relevant clicks in Shadow DOMs (as we've done in fred), this change upstream would result in duplicated pings.

Tests

I've tested with a local build of glean, I couldn't find any tests with related to this data-glean-id auto pinging: I'm happy to add a test if pointed in the right direction.

Pull Request checklist

  • Quality: Make sure this PR builds and runs cleanly.
    • Inside the glean/ folder, run:
      • npm run test Runs all tests
      • npm run lint Runs all linters
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry to CHANGELOG.md or an explanation of why it does not need one
  • Documentation: This PR includes documentation changes, an explanation of why it does not need that or a follow-up bug has been filed to do that work

@auto-assign auto-assign bot requested a review from badboy September 11, 2025 16:53
@LeoMcA LeoMcA changed the title Record clicks on elements in Shadow DOM Bug 1988206 - Record clicks on elements in Shadow DOM Sep 11, 2025
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.

1 participant