Skip to content

Conversation

@rgaignault
Copy link
Contributor

@rgaignault rgaignault commented Dec 18, 2025

Motivation

Clicks inside Shadow DOM components currently result in imprecise action names because event.target is retargeted to the shadow host.

Changes

This PR adds experimental support for extracting accurate action names from elements inside Shadow DOM

  • betaTrackActionsInShadowDom Enables action name extraction from Shadow DOM elements
  • Uses event.composedPath() to get the actual clicked element

This is the first phase of Shadow DOM support, focusing on action names only. Selector tracking inside Shadow DOM will be added in a follow-up PR. This feature is experimental and gated behind the betaTrackActionsInShadowDom opt-in parameter.

Test instructions

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@rgaignault rgaignault requested a review from a team as a code owner December 18, 2025 13:45
@rgaignault rgaignault marked this pull request as draft December 18, 2025 13:54
@rgaignault rgaignault marked this pull request as ready for review December 18, 2025 14:45
@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Jan 7, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 164.34 KiB 164.90 KiB +573 B +0.34%
Rum Profiler 4.32 KiB 4.32 KiB 0 B 0.00%
Rum Recorder 20.03 KiB 20.03 KiB 0 B 0.00%
Logs 56.14 KiB 56.14 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 121.62 KiB 122.21 KiB +600 B +0.48%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.0046 0.0066 +43.48%
RUM - add action 0.0132 0.019 +43.94%
RUM - add error 0.0145 0.0154 +6.21%
RUM - add timing 0.0028 0.0039 +39.29%
RUM - start view 0.0035 0.004 +14.29%
RUM - start/stop session replay recording 0.0007 0.0008 +14.29%
Logs - log message 0.0147 0.0162 +10.20%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 25.63 KiB 25.97 KiB +353 B
RUM - add action 49.22 KiB 51.07 KiB +1.85 KiB
RUM - add timing 23.95 KiB 24.39 KiB +449 B
RUM - add error 55.41 KiB 55.77 KiB +364 B
RUM - start/stop session replay recording 23.60 KiB 23.77 KiB +176 B
RUM - start view 423.90 KiB 421.14 KiB -2.76 KiB
Logs - log message 44.35 KiB 45.22 KiB +895 B

🔗 RealWorld

@datadog-official
Copy link

datadog-official bot commented Jan 7, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 77.42%
Overall Coverage: 77.22% (-0.02%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ce2bd06 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Copy link
Contributor

@BeltranBulbarellaDD BeltranBulbarellaDD left a comment

Choose a reason for hiding this comment

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

Nice! Works perfectly with the html test you sent me.
Looks good in the explorer UI too

})
})

describe('shadow DOM support', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 suggestion: ‏Could be nice to also test privacy settings with shadow dom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea ! I added one 👍

* @category Beta
* @defaultValue false
*/
betaTrackActionsInShadowDom?: boolean | undefined
Copy link
Collaborator

Choose a reason for hiding this comment

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

💭 thought: I don’t think we need the beta prefix. IMO, the implementation is not too complex to justify it.
I recommend putting the feature behind a feature flag so we can easily enable or disable it during dogfooding.

@rgaignault rgaignault merged commit 8fe0b89 into main Jan 16, 2026
21 checks passed
@rgaignault rgaignault deleted the romanG/action-name-shadow-dom branch January 16, 2026 08:51
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants