feat(SectionCampaign): add title-selector attribute for customizable title injection#1032
Merged
timowestnosto merged 7 commits intomainfrom Feb 19, 2026
Merged
Conversation
Co-authored-by: timowestnosto <13622115+timowestnosto@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for customizable title injection in SectionCampaign
feat(SectionCampaign): add title-selector attribute for customizable title injection
Feb 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a title-selector attribute to nosto-section-campaign so consumers can control which heading element receives the injected campaign title, while keeping the existing .nosto-title default behavior.
Changes:
- Introduced optional
titleSelector(title-selector) attribute/property onSectionCampaign. - Updated title injection to use
this.titleSelector || ".nosto-title"for backward-compatible behavior. - Added tests for custom selector usage and default selector fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/components/SectionCampaign/SectionCampaign.ts | Adds titleSelector support and uses it to locate the heading element for title injection. |
| test/components/SectionCampaign/SectionCampaign.spec.tsx | Adds coverage for custom title-selector and verifies default .nosto-title behavior remains intact. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: timowestnosto <13622115+timowestnosto@users.noreply.github.com>
Copilot
AI
changed the title
feat(SectionCampaign): add title-selector attribute for customizable title injection
feat(SectionCampaign): add opt-in title-selector attribute for title injection
Feb 19, 2026
| * | ||
| * @property {string} placement - The placement identifier for the campaign. | ||
| * @property {string} section - The section to be used for Section Rendering API based rendering. | ||
| * @property {string} [titleSelector] - CSS selector for the title element to inject the campaign title (attribute: "title-selector"). If not provided, no title injection will be performed. |
Co-authored-by: timowestnosto <13622115+timowestnosto@users.noreply.github.com>
Co-authored-by: timowestnosto <13622115+timowestnosto@users.noreply.github.com>
Copilot
AI
changed the title
feat(SectionCampaign): add opt-in title-selector attribute for title injection
feat(SectionCampaign): add title-selector attribute for customizable title injection
Feb 19, 2026
manikandan-ravikumar
approved these changes
Feb 19, 2026
|
🎉 This PR is included in version 11.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Context
Adds a
title-selectorattribute to SectionCampaign component to enable customizable title injection. When provided, the component will inject the campaign title into the element matching the specified CSS selector. Title injection only occurs when the attribute is explicitly provided.Related Jira ticket
N/A
Screenshots
N/A
Changes:
titleSelectorproperty to SectionCampaign componenttitle-selectorattribute is explicitly providedtitle-selector)Usage:
Note: Title injection is opt-in and only occurs when the
title-selectorattribute is provided. ThetitleSelectorproperty expects a valid CSS selector; invalid selectors will throw aDOMExceptionas per standard DOM behavior.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.