Skip to content

Add component-id for HighlightsNewsletterCard#16272

Open
georgerichmond wants to merge 7 commits into
mainfrom
16261-add-data-component-id-to-highlightsnewslettercard
Open

Add component-id for HighlightsNewsletterCard#16272
georgerichmond wants to merge 7 commits into
mainfrom
16261-add-data-component-id-to-highlightsnewslettercard

Conversation

@georgerichmond

@georgerichmond georgerichmond commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Adds a data-modal-component-id attribute to the <a> tag in HighlightsNewsletterCard:

  • data-modal-component-id — matches the signup modal's Ophan component.id (HighlightsNewsletterModal <identityName>)

The value is derived from the existing NEWSLETTER_SIGNUP_COMPONENT_ID.highlightsModal helper, so it is guaranteed to stay in sync with the events already sent to Ophan. Tests are updated to assert the attribute is present and correctly valued.

Why?

Heatphan needs a DOM hook on the Highlights card to display modal-open and subscribe counts as a badge on the front. It listens for Ophan EXPAND and SUBSCRIBE events, using the component.id to identify which element to update — so the <a> tag needs a matching attribute for Heatphan to hook into.

The card and its modal have separate component IDs (split in #16258, because EXPAND fires twice — once when the modal opens, and again when the captcha loads — and a shared ID made them indistinguishable). data-modal-component-id points to the modal's ID, which is the one associated with the EXPAND (modal-open) and SUBSCRIBE events Heatphan cares about.

Screenshots

No visual change.

@georgerichmond georgerichmond linked an issue Jun 25, 2026 that may be closed by this pull request
4 tasks
@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@georgerichmond georgerichmond added the feature Departmental tracking: work on a new feature label Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

@georgerichmond georgerichmond force-pushed the 16261-add-data-component-id-to-highlightsnewslettercard branch from da29006 to 238961c Compare June 29, 2026 11:37
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

@georgerichmond georgerichmond added the run_chromatic Runs chromatic when label is applied label Jun 29, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add data-component-id to HighlightsNewsletterCard

1 participant