Skip to content

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

Open
rkeerthient wants to merge 9 commits intomainfrom
links-nearby-locations-new
Open

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
rkeerthient wants to merge 9 commits intomainfrom
links-nearby-locations-new

Conversation

@rkeerthient
Copy link
Contributor

@rkeerthient rkeerthient commented Feb 2, 2026

JIRA - OPAQF-92, OPAQF-93

Locator:

  • Page title is editable, defaults to H1, and supports color customization.
  • Heading in Location result cards support color customization.
  • Added a migration file to set a default page title. When I tried setting this in the component using resolveFields, on-load, it applied changes and showed a Discard changes option enabled. Clicking discard cleared the title prop.

Nearby Locations:

  • Title in Nearby Location cards support color customization.

Updated test cases and locales.

Known Issue:

  • Unsure why the latitude is updated in Nearby location cards.
  • For locator result cards, the serial number now uses the same color as the title.
Screen.Recording.2026-02-02.at.2.27.58.PM.mov

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

This 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 pageHeading prop.

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
Loading

Possibly related PRs

Suggested Labels

create-dev-release

Suggested Reviewers

  • benlife5
  • asanehisa
  • mkilpatrick
  • briantstephan
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title comprehensively describes all major changes: locator page title editing, h1 semantic markup, and color selection for locator/nearby location components.
Description check ✅ Passed The description provides detailed context for the changeset, including specific objectives (page title editability, color customization, migration logic), affected components, test updates, and known issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch links-nearby-locations-new

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

Remove version 57 suppression of accessibility assertions.

Logging violations with console.warn masks 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 | 🟡 Minor

Fix localization fallback for missing heading translations.

When pageHeading.title lacks a translation for the current locale, resolveComponentData returns an empty string. The ?? operator does not trigger on empty strings, so the heading will render blank instead of falling back to DEFAULT_TITLE. Use t("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>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this isn't using Yext Field?

Copy link
Contributor Author

@rkeerthient rkeerthient Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be YextField as well with type: "text" rather than "entityField"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YextField doesn't automatically mean it won't be static, just our wrapper on puck fields to enable more functionality we want

},
}
),
pageHeading: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can also use YextField!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't use YextField as the ticket says it should be a static text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.

3 participants