Skip to content

fix: resolve external <label for> for CollectionPreferences toggle analytics label#4711

Merged
gethinwebster merged 2 commits into
mainfrom
dev-v3-gethinw-cp-label-analytics-test
Jul 22, 2026
Merged

fix: resolve external <label for> for CollectionPreferences toggle analytics label#4711
gethinwebster merged 2 commits into
mainfrom
dev-v3-gethinw-cp-label-analytics-test

Conversation

@gethinwebster

@gethinwebster gethinwebster commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

CollectionPreferences visible-content / content-display option toggles emitted an empty autoCaptureLabel because their label is an external <label for> and AbstractSwitch pointed detail.label at 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 to getLabelFromElement, 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.tsx asserts a visible-content option toggle emits detail.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

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…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
gethinwebster force-pushed the dev-v3-gethinw-cp-label-analytics-test branch from 7efffc6 to c30d0ab Compare July 22, 2026 11:11
@gethinwebster gethinwebster changed the title test: CollectionPreferences visible-content toggle resolves column label (blocked on toolkit#228) fix: resolve external <label for> for CollectionPreferences toggle analytics label Jul 22, 2026
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
gethinwebster added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 2a4e26e Jul 22, 2026
57 checks passed
@gethinwebster
gethinwebster deleted the dev-v3-gethinw-cp-label-analytics-test branch July 22, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants