Conversation
|
ef1d48e was deployed to: https://fred-pr1279.review.mdn.allizom.net/ |
Add missing toggle event handler for data-glean-toggle-open attribute. Fixes #1035
7f33adc to
e453d13
Compare
Instead, measure the top nav login in the `user-menu` component, which does NOT use the `login-button` component.
caugner
left a comment
There was a problem hiding this comment.
Reviewed all changes, will test next.
Glean Measurement Testing Checklist
Accessibility Menu (
|
🐛 Also fires when selecting an item.
🐛 Fires both on open and close.
🐛 No event observed (maybe because the
Need to test locally.
Need to test locally.
🐛 No event.
🐛 Fires when item is selected, not when the select is opened.
Need to test locally. |
On first Lit render, `open` changes from `undefined` to `false`, which was incorrectly triggering a `toggle` event and causing `theme_switcher: close` (and similar) to fire on page load.
Selecting an option programmatically closes the dropdown, which was incorrectly firing a `close` event in addition to the `switch` event.
The button's data-glean-id fired on every click (both open and close). Moved tracking to data-glean-toggle-open on mdn-dropdown and extended glean-init's toggle handler to support any element with an `open` property (not only <details>).
✅ Fixed via ed7ff87.
✅ Fixed via 7cfb63b.
✅ Fixed via f738244.
✅ Works as expected.
The news don't render locally, but those are just links, so I have high confidence that it works.
✅ Fixed via db8005f.
✅ Fixed via f857a2d.
✅ Fixed via 2855bdd (didn't fire). |
data-glean-id on mdn-button is unreachable via closest() when the click originates from the nested <a> inside mdn-button's shadow DOM. Using a direct gleanClick call avoids the shadow boundary limitation.
The event was gated behind a controller null-check, so it could be silently dropped. Fire gleanClick as soon as the user confirms the dialog, independent of the controller reference.
d8c185e to
875f6ed
Compare
The event was firing on the change event (item selected) rather than when the select dropdown is opened. Moved it to focus on the select element, which fires when the select gains focus (once per open action).
The dialog element is not visible in the viewport when the user hasn't opened it yet, so the IntersectionObserver never fired. Moving the ref to the body div ensures the element is in flow and observable.
875f6ed to
2855bdd
Compare
LeoMcA
left a comment
There was a problem hiding this comment.
Still going through it, but one comment so far:
| this.addEventListener("click", () => { | ||
| const gleanId = this.dataset.gleanId; | ||
| if (gleanId) { | ||
| gleanClick(gleanId); | ||
| } | ||
| }); |
There was a problem hiding this comment.
I'm interested why this is necessary, as I would've thought our shadow dom workaround code in glean-init.js would cover this case:
Lines 28 to 38 in 88f55bc
There was a problem hiding this comment.
The workaround works if the element with data-glean-id is inside the shadow DOM, but in this case the attribute is set on the host element, so closest() returns null.
I think this article describes this.
But we might be able to do something like this instead:
event.composedPath().find(el => el instanceof Element && el.matches(selector)) ?? null;
There was a problem hiding this comment.
- 4447fb7: Use
composedPath()instead ofclosest() - 96da56f: Reverts the mdn-button click handler.
- 3508870: Measure all
data-glean-ids along the path (e.g. the login button in Playground should be measured both aslogin_button(via<mdn-login-button>) andplayground: banner-login(via<mdn-playground>).
This reverts commit f738244.
Description
Adds several missing Glean measurements, and corrects some.
Motivation
Ensure we can make data-driven decisions about the affected features.
Additional details
Related issues and pull requests
Related to #647.
Fixes several issues, mentioned directly in the commits.