Fix: "Contact support" leads to an iframe error on the current tab#24626
Fix: "Contact support" leads to an iframe error on the current tab#24626niranjan-uma-shankar wants to merge 1 commit intoTryGhost:mainfrom
Conversation
This removes redundant onClick handler for the support link, and also adds a target _blank attribute to prevent iframe error on the current tab.
WalkthroughThe 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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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 emptyCurrently, 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 windowTo 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
📒 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 — LGTMRemoving the onClick and adding target="_blank" prevents the current-tab navigation that breaks inside iframes. rel="noopener noreferrer" is appropriate. Good change.
Summary
Clicking "Contact support" in Portal triggers two navigation attempts: one from the
hrefattribute (which navigates in the current tab) and one from theonClickhandler (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:
hrefattribute and anonClickhandler, creating conflicting navigation behaviour.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:
Testing Instructions
/membersadd 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.