feat: locator's page title is editable and set to h1, color selection added to locator's page title, locator cards and nearby locations cards#1015
Conversation
…r results card, locator title and neary locations
WalkthroughThis PR adds a configurable, translatable page heading to the Locator component (title + optional SITE_COLOR), updates LocatorResultCard and NearbyLocations wrappers to accept heading colors, adds translations for the new key across platform locales, introduces a migration to inject a default locator title, updates tests to cover color variants, and documents the new Sequence Diagram(s)sequenceDiagram
participant Editor as Visual Editor
participant Migration as Migration System
participant LocatorComp as Locator Component
participant i18n as Translation System
participant UI as Rendered Output
Editor->>Migration: Provide component props (may omit pageHeading)
activate Migration
Migration->>LocatorComp: apply addDefaultLocatorPageTitle migration
LocatorComp->>LocatorComp: ensure pageHeading.title.en exists (inject default if missing)
deactivate Migration
LocatorComp->>i18n: resolveComponentData(pageHeading.title, language, document)
activate i18n
i18n-->>LocatorComp: localized heading string
deactivate i18n
LocatorComp->>LocatorComp: determine heading color (optional SITE_COLOR)
LocatorComp->>UI: render heading with localized text and color
activate UI
UI-->>UI: display translated, colored page heading
deactivate UI
Possibly related PRs
Suggested Labels
Suggested Reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.test.tsx (1)
610-618:⚠️ Potential issue | 🟠 MajorRemove version 57 suppression of accessibility assertions.
Logging violations with
console.warnmasks potential accessibility regressions during heading and color work. Either enforce assertions for all versions or explicitly allowlist known violations with a tracked TODO.Suggested fix (restore enforcement)
const results = await axe(container); - if (version === 57) { - console.warn(results); - } else { - expect(results).toHaveNoViolations(); - } + expect(results).toHaveNoViolations();const results = await axe(container); - if (version === 57) { - console.warn(results); - } else { - expect(results).toHaveNoViolations(); - } + expect(results).toHaveNoViolations();Also applies to: 624-629
packages/visual-editor/src/components/Locator.tsx (1)
1107-1121:⚠️ Potential issue | 🟡 MinorFix localization fallback for missing heading translations.
When
pageHeading.titlelacks a translation for the current locale,resolveComponentDatareturns an empty string. The??operator does not trigger on empty strings, so the heading will render blank instead of falling back toDEFAULT_TITLE. Uset("findALocation", DEFAULT_TITLE)to ensure non-English users see a localized heading with proper fallback.Suggested fix
const resolvedHeading = resolveComponentData(pageHeading?.title, i18n.language, streamDocument) ?? - DEFAULT_TITLE; + t("findALocation", DEFAULT_TITLE);
🤖 Fix all issues with AI agents
In `@packages/visual-editor/src/components/Locator.tsx`:
- Around line 450-453: The new required pageHeading prop in the Locator
component type makes a breaking change; make it optional by changing the
declaration of pageHeading to pageHeading?: { title: TranslatableString; color?:
BackgroundStyle; } and update any places that destructure or assume its presence
(e.g., Locator props usage, render helpers) to handle undefined safely (use
existing defaults or optional chaining/null coalescing) so runtime
defaults/migrations remain sufficient.
| label: msg("fields.pageHeading", "Page Heading"), | ||
| type: "object", | ||
| objectFields: { | ||
| title: TranslatableStringField<TranslatableString>( |
There was a problem hiding this comment.
Any reason this isn't using Yext Field?
There was a problem hiding this comment.
Didn't use YextField as the ticket says it should be a static text. Plz advice if I still need to go ahead with YextField.
There was a problem hiding this comment.
This can be YextField as well with type: "text" rather than "entityField"
There was a problem hiding this comment.
YextField doesn't automatically mean it won't be static, just our wrapper on puck fields to enable more functionality we want
| }, | ||
| } | ||
| ), | ||
| pageHeading: { |
There was a problem hiding this comment.
this can also use YextField!
There was a problem hiding this comment.
Didn't use YextField as the ticket says it should be a static text.
There was a problem hiding this comment.
For PageHeading u can do
YextField(msg("fields.pageHeading", "Page Heading"), {
type: "object",
objectFields: {
...
},
}),
| const resolvedHeading = | ||
| (pageHeading?.title && | ||
| resolveComponentData(pageHeading.title, i18n.language, streamDocument)) || | ||
| t(DEFAULT_TITLE); |
There was a problem hiding this comment.
Sorry, this is my bad but I think it needs to be t("findALocation", "Find a Location") since t(DEFAULT_TITLE/"Find a Location") won't match to a translation. You can check with the Set Components Locale button when running locally
JIRA - OPAQF-92, OPAQF-93
Locator:
Nearby Locations:
Updated test cases and locales.
Known Issue:
Screen.Recording.2026-02-02.at.2.27.58.PM.mov