-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Right now it's hard to identify elements a user clicked on when trying to follow breadcrumb trails see:

Because the way we serialize dom elements doesn't work well with autogenerated class names.
It would be cool if users could define an attribute name we prefer when serializing dom elements.
So how it could work is that we extend BreadcrumbsOptions so
dom: boolean | { serializeAttribute: string } and take this attribute instead of the classname / id
https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L163
Ref:
https://forum.sentry.io/t/dom-interactions-selectors/3592
https://forum.sentry.io/t/ui-click-dom-events-with-a-custom-sentry-html-tag/1084
The trail to follow how to implement:
https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L163
->
| export function htmlTreeAsString(elem: unknown): string { |
->
| function _htmlElementAsString(el: unknown): string { |