Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.5...main)

* [#2013](https://github.com/mozilla/glean.js/pull/2011): Bug 1988206 - Record clicks on elements in Shadow DOM.
* [#2011](https://github.com/mozilla/glean.js/pull/2011): Bug 1987158 - Capture page `url`/`referrer`/`title` with `recordElementClick()`.

# v5.0.5 (2025-07-17)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Glean.initialize("app-name", true, {
});
```

Glean.js will create a global click listener to catch all clicks for
Glean.js will create a global click listener to catch all clicks (including in Shadow DOMs) for
elements that include one of the following data attributes:

- `data-glean-id`
Expand Down
2 changes: 1 addition & 1 deletion glean/src/core/glean_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace GleanMetrics {
* @param event Event object.
*/
export function handleClickEvent(event: Event) {
const clickedElement = event.target as Element;
const clickedElement = (event.composedPath()?.[0] || event.target) as Element;
const closestElementWithClickAttributes: Element | null = clickedElement.closest("[data-glean-id], [data-glean-type], [data-glean-label]");

if (!closestElementWithClickAttributes) {
Expand Down