Skip to content

Conversation

@rkeerthient
Copy link
Contributor

Ticket - https://yext.atlassian.net/browse/OPAQF-68?search_id=ef403121-0508-4063-915c-24698c7ce550.

  • Made header logo clickable in both mobile and desktop view.
  • Added a link validation and fallback to DEFAULT_LOGO_LINK.
  • Add eventName as clickedLogo and aria-label as Logo Link
Screen.Recording.2025-12-02.at.3.49.43.PM.mov

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

Walkthrough

Adds a new TranslatableString field logoLink to ExpandedHeader.primaryHeader, wires it into the UI schema, default props, i18n resolution and rendering (logo wrapped with a Link), adds basic URL validation and a default fallback, updates types and docs (TranslatableString, ExpandedHeaderData), adds unit tests for valid/invalid logoLink, and adds logoLink entries across many visual-editor locale JSON files.

Sequence Diagram(s)

sequenceDiagram
    participant Browser as Browser (component render)
    participant ExpandedHeader as ExpandedHeader Component
    participant I18n as i18n Resolver
    participant RouterLink as Link Component / Router

    Browser->>ExpandedHeader: render with data.primaryHeader.logoLink
    ExpandedHeader->>I18n: resolveTranslatableString(logoLink)
    I18n-->>ExpandedHeader: resolvedLink (string)
    ExpandedHeader->>ExpandedHeader: validate resolvedLink (LINK_REGEX_VALIDATION)
    alt valid
        ExpandedHeader->>RouterLink: render <Link href=resolvedLink>logo</Link>
        RouterLink-->>Browser: clickable logo -> navigates
    else invalid
        ExpandedHeader->>RouterLink: render <Link href=DEFAULT_LOGO_LINK>logo</Link>
        RouterLink-->>Browser: clickable logo -> DEFAULT_LOGO_LINK
    end
Loading

Possibly related PRs

Suggested labels

create-dev-release

Suggested reviewers

  • mkilpatrick
  • briantstephan
  • colton-demetriou

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a clickable link functionality to the header logo, which aligns with the primary objective of the changeset.
Description check ✅ Passed The description is directly related to the changeset, referencing the ticket, explaining the logo link functionality, validation logic, and accessibility improvements that match the code changes.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OPAQF-68

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

🧹 Nitpick comments (4)
packages/visual-editor/src/components/header/ExpandedHeader.test.tsx (1)

444-517: Consider adding assertions for logo link functionality.

While the snapshot tests verify visual rendering, the PR objectives mention several specific behaviors that should be tested:

  • Link validation and fallback to DEFAULT_LOGO_LINK
  • eventName = "clickedLogo"
  • aria-label = "Logo Link"

The current tests only render the component without verifying these functional requirements. Consider adding assertions to verify:

  1. Valid URLs are rendered correctly as links
  2. Invalid URLs fall back to the default link
  3. The logo link has the correct aria-label
  4. Analytics events are fired with the correct event name

This would help prevent regressions if the validation logic, fallback behavior, or accessibility features are modified in the future.

packages/visual-editor/src/components/header/ExpandedHeader.tsx (3)

47-48: Consider strengthening URL validation.

The regex pattern allows some edge cases that may not be valid URLs:

  • http:// or https:// without a domain would match
  • Special characters that are invalid in URLs are not filtered

However, if the intent is to provide flexible validation that also accepts relative paths and hash links, this might be acceptable.

Consider adding more robust validation:

-const LINK_REGEX_VALIDATION = /^(https?:\/\/[^\s]+|\/[^\s]*|#[^\s]*)$/;
+const LINK_REGEX_VALIDATION = /^(https?:\/\/[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]+|\/[^\s]*|#[^\s]*)$/;

Or use a more comprehensive URL validation library for production use. You could also add a minimum length check for absolute URLs to prevent matching just the protocol.


419-424: Consider logging validation failures.

The link resolution logic correctly validates and falls back to DEFAULT_LOGO_LINK, but invalid links fail silently. This could make it difficult to debug configuration issues.

Consider adding a console warning for development:

  const inputLink = resolveComponentData(logoLink, i18n.language);
  const resolvedLink =
    typeof inputLink === "string" &&
    LINK_REGEX_VALIDATION.test(inputLink.trim())
      ? inputLink.trim()
-      : DEFAULT_LOGO_LINK;
+      : (console.warn(`[ExpandedHeader] Invalid logoLink "${inputLink}", falling back to ${DEFAULT_LOGO_LINK}`),
+         DEFAULT_LOGO_LINK);

This would help content editors identify when their logo link configuration is invalid.


524-548: Improve aria-label for better accessibility.

The aria-label={t("logoLink", "Logo Link")} describes the technical nature of the element rather than its function. Screen reader users would benefit from a more descriptive label.

Consider using a more user-friendly aria-label:

                <Link
                  href={resolvedLink}
                  eventName="clickedLogo"
-                  aria-label={t("logoLink", "Logo Link")}
+                  aria-label={t("logoLinkAriaLabel", "Navigate to home")}
                >

You would need to add the corresponding translation key logoLinkAriaLabel to all locale files. This better communicates the action to users relying on assistive technologies.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb049bb and 907ec10.

⛔ Files ignored due to path filters (22)
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 10 props - secondary header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 10 props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 11 props - secondary header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 15 props - fixed header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 15 props - sticky header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 24 props - logo Link - Invald.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[desktop] version 24 props - logo Link - Valid.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] default props (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 10 props (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 10 props - secondary header (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 11 props - secondary header (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 15 props - fixed header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 15 props - sticky header (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 24 props - logo Link - Invald.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[mobile] version 24 props - logo Link - Valid.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 10 props - secondary header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 11 props - secondary header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 15 props - fixed header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 15 props - sticky header.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 24 props - logo Link - Invald.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ExpandedHeader/[tablet] version 24 props - logo Link - Valid.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (29)
  • packages/visual-editor/locales/cs/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/da/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/de/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/en-GB/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/en/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/es/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/et/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/fi/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/fr/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/hr/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/hu/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/it/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/ja/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/lt/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/lv/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/nb/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/nl/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/pl/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/pt/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/ro/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/sk/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/sv/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/tr/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/zh-TW/visual-editor.json (2 hunks)
  • packages/visual-editor/locales/zh/visual-editor.json (2 hunks)
  • packages/visual-editor/src/components/header/ExpandedHeader.test.tsx (1 hunks)
  • packages/visual-editor/src/components/header/ExpandedHeader.tsx (10 hunks)
  • packages/visual-editor/src/docs/ai/components.d.ts (3 hunks)
  • packages/visual-editor/src/docs/components.md (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/visual-editor/src/components/header/ExpandedHeader.tsx (4)
packages/visual-editor/src/types/types.ts (1)
  • TranslatableString (205-205)
packages/visual-editor/src/editor/YextField.tsx (1)
  • YextField (188-318)
packages/visual-editor/src/utils/index.ts (1)
  • resolveComponentData (19-19)
packages/visual-editor/src/utils/resolveComponentData.tsx (1)
  • resolveComponentData (52-99)
packages/visual-editor/src/docs/ai/components.d.ts (1)
packages/visual-editor/src/types/types.ts (1)
  • TranslatableString (205-205)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: call_unit_test / unit_tests (20.x)
  • GitHub Check: call_unit_test / unit_tests (18.x)
  • GitHub Check: semgrep/ci
🔇 Additional comments (22)
packages/visual-editor/locales/es/visual-editor.json (1)

227-227: ✓ Spanish translations added correctly.

Both logoLink entries ("Enlace del logotipo") are properly placed within the fields section and at the top level. Translation is grammatically appropriate and consistent.

Also applies to: 475-475

packages/visual-editor/locales/fr/visual-editor.json (1)

227-227: ✓ French translations added correctly.

Both logoLink entries ("Lien vers le logo") follow the established pattern. Translation is natural and appropriate for French.

Also applies to: 475-475

packages/visual-editor/locales/fi/visual-editor.json (1)

228-228: ✓ Finnish translations added correctly.

Both logoLink entries ("Logo linkki") are properly positioned and consistent with the multilingual pattern.

Also applies to: 476-476

packages/visual-editor/locales/hu/visual-editor.json (1)

228-228: ✓ Hungarian translations added correctly.

Both logoLink entries ("Logo link") are consistently placed and properly formatted.

Also applies to: 476-476

packages/visual-editor/locales/cs/visual-editor.json (1)

229-229: ✓ Czech translations added correctly.

Both logoLink entries ("Odkaz na logo") are properly positioned with appropriate Czech phrasing.

Also applies to: 477-477

packages/visual-editor/locales/pl/visual-editor.json (1)

229-229: ✓ Polish translations added correctly.

Both logoLink entries ("Link do logo") are consistently placed and grammatically appropriate.

Also applies to: 477-477

packages/visual-editor/locales/pt/visual-editor.json (1)

228-228: ✓ Portuguese translations added correctly.

Both logoLink entries ("Link do logotipo") are properly positioned and linguistically appropriate.

Also applies to: 476-476

packages/visual-editor/locales/de/visual-editor.json (1)

227-227: ✓ German translations added correctly.

Both logoLink entries ("Logo-Link") are properly placed with appropriate German compound word formatting using hyphen.

Also applies to: 475-475

packages/visual-editor/locales/et/visual-editor.json (1)

228-228: LGTM! Localization entry added correctly.

The logoLink translation key has been properly added to support the new logo link feature in the ExpandedHeader component.

Also applies to: 476-476

packages/visual-editor/locales/zh/visual-editor.json (1)

228-228: LGTM! Chinese translation added correctly.

The logoLink translation follows the same pattern as other locale files in this PR.

Also applies to: 476-476

packages/visual-editor/locales/en-GB/visual-editor.json (1)

227-227: LGTM! British English translation added correctly.

The logoLink translation has been added consistently with other locale files.

Also applies to: 475-475

packages/visual-editor/locales/sk/visual-editor.json (1)

229-229: LGTM! Slovak translation added correctly.

The logoLink translation follows the established pattern across all locale files.

Also applies to: 477-477

packages/visual-editor/locales/sv/visual-editor.json (1)

229-229: LGTM! Swedish translation added correctly.

The logoLink translation is consistent with the other locale additions in this PR.

Also applies to: 477-477

packages/visual-editor/locales/it/visual-editor.json (1)

228-228: LGTM! Italian translation added correctly.

The logoLink translation maintains consistency with other locale files in this PR.

Also applies to: 476-476

packages/visual-editor/src/docs/ai/components.d.ts (1)

410-410: LGTM! Logo link field added to header data interface.

The logoLink field has been correctly added to ExpandedHeaderData.primaryHeader as a TranslatableString, which aligns with the PR objectives to make the header logo clickable with multi-locale support.

packages/visual-editor/locales/hr/visual-editor.json (1)

228-228: LGTM!

The translation keys for logoLink are properly added in both locations (within the fields section and at the root level), which aligns with the translation structure used by other fields in the visual editor.

Also applies to: 476-476

packages/visual-editor/locales/ro/visual-editor.json (1)

228-228: LGTM!

The Romanian translations for logoLink are correctly added and follow the same pattern as other locale files.

Also applies to: 476-476

packages/visual-editor/locales/en/visual-editor.json (1)

227-227: LGTM!

The English translations for logoLink are properly added and will serve as the primary reference for other locales.

Also applies to: 475-475

packages/visual-editor/src/components/header/ExpandedHeader.tsx (3)

78-78: LGTM!

The logoLink field is correctly typed as TranslatableString, which properly supports both constant values and localized content.


155-157: LGTM!

The UI schema field definition for logoLink is properly configured as a translatable string field with appropriate internationalization support.


886-886: LGTM!

The default value for logoLink is properly structured and consistent with other default link values in the component. While "#" is a safe placeholder, ensure users are guided to configure this to point to their actual homepage or desired destination.

packages/visual-editor/src/docs/components.md (1)

248-251: LGTM!

The documentation accurately reflects the addition of the logoLink field to the ExpandedHeader component's data structure.

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: 0

🧹 Nitpick comments (1)
packages/visual-editor/src/docs/components.md (1)

248-251: Consider enhancing the description for ExpandedHeader data props.

The table correctly reflects the addition of logoLink: TranslatableString to the data.primaryHeader type. However, the description "Content for the main primary header bar" is generic and doesn't explain what individual fields do (e.g., that logoLink makes the logo clickable). Developers reading this documentation would benefit from either:

  1. A more detailed description explaining each field, or
  2. Individual table rows breaking down logo, logoLink, links, and CTAs separately.

That said, this matches the existing documentation style used for other complex types (e.g., ExpandedFooter). If you prefer consistency with the current approach, this is fine as-is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4414c7 and 6e424d9.

📒 Files selected for processing (1)
  • packages/visual-editor/src/docs/components.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: call_unit_test / unit_tests (20.x)
  • GitHub Check: call_unit_test / unit_tests (18.x)
  • GitHub Check: semgrep/ci

Copy link
Contributor

@asanehisa asanehisa left a comment

Choose a reason for hiding this comment

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

lgtm besides screenshots merge conflict (sorry)

@rkeerthient rkeerthient requested a review from benlife5 December 3, 2025 16:50
@asanehisa
Copy link
Contributor

btw this has locale conflicts still

@benlife5
Copy link
Contributor

@rkeerthient Can you fix the merge conflict?

@rkeerthient
Copy link
Contributor Author

@benlife5, @asanehisa created a new PR here. Please disregard the current one. Thanks.

benlife5 pushed a commit that referenced this pull request Dec 16, 2025
Since there were a lot of conflicts as the older
[PR](#925) was before the
slots, creating this off the latest main.

Added a `Data` prop under `Primary Header.` with `Logo Link`.


https://github.com/user-attachments/assets/fff1e842-0a6e-43cd-b833-3bc2f979fe8f

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
k-gerner pushed a commit that referenced this pull request Dec 17, 2025
Since there were a lot of conflicts as the older
[PR](#925) was before the
slots, creating this off the latest main.

Added a `Data` prop under `Primary Header.` with `Logo Link`.


https://github.com/user-attachments/assets/fff1e842-0a6e-43cd-b833-3bc2f979fe8f

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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