fix: resolve external <label for> for CollectionPreferences toggle analytics label#4711
Merged
Merged
Conversation
…s column label Adds an analytics-metadata test that a visible-content column toggle emits its column label (via the associated <label for>). Blocked on component-toolkit#228 (adds <label for> resolution to getLabelFromElement); CI is red until that merges to toolkit mainline.
gethinwebster
force-pushed
the
dev-v3-gethinw-cp-label-analytics-test
branch
from
July 22, 2026 11:11
7efffc6 to
c30d0ab
Compare
AbstractSwitch pointed the interaction detail.label at .native-input when a control has no inline label, relying on the consumer to walk input.id -> label[for]. Auto-capture in production does not do that walk, so CollectionPreferences visible-content/content-display option toggles emitted an empty autoCaptureLabel. Point detail.label directly at the associated label[for] element so its text is captured with no lookup.
gethinwebster
force-pushed
the
dev-v3-gethinw-cp-label-analytics-test
branch
from
July 22, 2026 11:17
c30d0ab to
5aebfbe
Compare
gethinwebster
marked this pull request as ready for review
July 22, 2026 12:36
SpyZzey
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CollectionPreferencesvisible-content / content-display option toggles emitted an emptyautoCaptureLabelbecause their label is an external<label for>andAbstractSwitchpointeddetail.labelat the label-less native input. Point it directly at the associated<label for>element so its text is captured. Inline-label and aria-labelled switches are unchanged.(component-toolkit#228 added
input.id → label[for]resolution togetLabelFromElement, but production auto-capture doesn't use that path, so resolving the label element directly is needed.)Related links, issue #, if available: component-toolkit#228
How has this been tested?
src/collection-preferences/__tests__/analytics-metadata.test.tsxasserts a visible-content option toggle emitsdetail.label: 'Domain name'. All collection-preferences analytics and toggle/checkbox/radio/abstract-switch unit tests pass.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.