Skip to content

Fix: "Contact support" leads to an iframe error on the current tab#24626

Open
niranjan-uma-shankar wants to merge 1 commit intoTryGhost:mainfrom
niranjan-uma-shankar:fix-email-support-iframe
Open

Fix: "Contact support" leads to an iframe error on the current tab#24626
niranjan-uma-shankar wants to merge 1 commit intoTryGhost:mainfrom
niranjan-uma-shankar:fix-email-support-iframe

Conversation

@niranjan-uma-shankar
Copy link
Contributor

@niranjan-uma-shankar niranjan-uma-shankar commented Aug 7, 2025

Summary

Clicking "Contact support" in Portal triggers two navigation attempts: one from the href attribute (which navigates in the current tab) and one from the onClick handler (new tab). The new tab opens correctly, but the current-tab attempt fails in the iframe context, resulting in an error.

Here's an example from a Ghost blog I follow:

Screen.Recording.2025-08-07.at.7.36.34.PM.mov

Root cause:

  • The element contains both a redundant href attribute and an onClick handler, creating conflicting navigation behaviour.
  • The Account modal is in an iframe. The target="_blank" attribute is missing for the "Contact support" button, so the browser attempts to open the default email client (e.g., Gmail) in the same tab, inside an iframe, which is blocked and results in the error.

Fix:

  • Remove the redundant onClick handler.
  • Add target="_blank" to ensure the email client opens in a new tab/window.

Testing Instructions

  • In your local repo, run the following:
yarn dev --portal
  • In /members add a new member. Click on the member to open the edit member page, click on the gear icon and click on "Impersonate" to copy the login link for that user.
  • Paste the copied link in a new tab to be logged in as this member. Click on the "Account" button on the top right corner of the page to open the account modal, and click on "Contact support".
  • Verify that the contact support link opens in a new tab, and that the current tab does not lead to any errors as described above.

This removes redundant onClick handler for the support link, and also adds a target _blank attribute to prevent iframe error on the current tab.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

The change updates a support mail link in AccountFooter.js. It removes a custom onClick handler that used window.open(supportAddressMail) and relies on standard anchor behavior. The mailto href remains the same, but the link now specifies target="_blank" and rel="noopener noreferrer". No other attributes, text, or structure were modified. No public/exported interfaces changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@niranjan-uma-shankar niranjan-uma-shankar marked this pull request as ready for review August 11, 2025 13:27
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 (2)
apps/portal/src/components/pages/AccountHomePage/components/AccountFooter.js (2)

15-15: Avoid rendering a mailto with no recipient when supportAddress is empty

Currently, supportAddress defaults to ''. This yields href="mailto:" which can be a confusing UX. Consider rendering the list item only when a support address is provided.

-                    <li>
-                        <a data-test-link="footer-support" className='gh-portal-btn gh-portal-btn-branded' href={supportAddressMail} target="_blank" rel="noopener noreferrer">{t('Contact support')}</a>
-                    </li>
+                    {supportAddress ? (
+                        <li>
+                            <a
+                                data-test-link="footer-support"
+                                className='gh-portal-btn gh-portal-btn-branded'
+                                href={supportAddressMail}
+                                target="_blank"
+                                rel="noopener noreferrer"
+                            >
+                                {t('Contact support')}
+                            </a>
+                        </li>
+                    ) : null}

15-15: Optional a11y: indicate that this opens your email app/new window

To set expectations, consider an accessible hint (localized if possible).

Example:

  • Add an aria-label or visually-hidden text: “Contact support (opens your email app)”.
  • Or add title="Opens your email app".
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 888ae06 and 8347b00.

📒 Files selected for processing (1)
  • apps/portal/src/components/pages/AccountHomePage/components/AccountFooter.js (1 hunks)
🔇 Additional comments (1)
apps/portal/src/components/pages/AccountHomePage/components/AccountFooter.js (1)

15-15: Fix eliminates iframe navigation conflict — LGTM

Removing the onClick and adding target="_blank" prevents the current-tab navigation that breaks inside iframes. rel="noopener noreferrer" is appropriate. Good change.

@ErisDS ErisDS added the community [triage] Community features and bugs label Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community [triage] Community features and bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants