Skip to content

minor accessibility updates for Portal #26394

Open
cathysarisky wants to merge 2 commits intoTryGhost:mainfrom
cathysarisky:portal-accessibility-tweaks
Open

minor accessibility updates for Portal #26394
cathysarisky wants to merge 2 commits intoTryGhost:mainfrom
cathysarisky:portal-accessibility-tweaks

Conversation

@cathysarisky
Copy link
Member

This PR makes minor adjustments to portal to increase accessibility for screen readers. No visual changes, just better accessibility for users who need to tab navigate or use a screen reader.

The close button is now a button, not a div, which buys it automatic focus-ability. I added css to remove the default button styling, and the click handler on the button, so that screen users and tab-navigators can access it.

Also updated the benefits "checks" to not get read by the screen reader.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 250f0298-0c97-46c9-936a-614f3e00aefe

📥 Commits

Reviewing files that changed from the base of the PR and between 007906c and c798c27.

📒 Files selected for processing (2)
  • apps/portal/src/components/frame.styles.js
  • apps/portal/src/components/pages/offer-page.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/portal/src/components/pages/offer-page.js
  • apps/portal/src/components/frame.styles.js

Walkthrough

Converted the close control from a div to a button, added an onClick prop with a fallback to this.closePopup, and applied the same fallback to the CloseIcon child. Added CSS reset rules (background, border, padding, margin) for the close icon container. Added aria-hidden="true" to CheckmarkIcon in two benefit renderings.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'minor accessibility updates for Portal' directly and concisely describes the main change in the changeset—improving accessibility of the Portal component.
Description check ✅ Passed The description is directly related to the changeset, explaining the accessibility improvements including converting the close control to a button and hiding checkmarks from screen readers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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

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

🤖 Fix all issues with AI agents
In `@apps/portal/src/components/common/close-button.js`:
- Around line 16-20: The CloseButton markup is causing accessibility and
correctness problems: add type="button" to the <button> element to prevent
accidental form submits, remove the duplicate onClick from the CloseIcon so the
handler (onClick || this.closePopup) is only attached to the button, and provide
an accessible name by adding an aria-label (e.g., aria-label="Close") or visible
text inside the button so screen readers can announce it; keep the CloseIcon as
a presentational SVG (no alt prop) and ensure the button uses the existing
onClick prop or this.closePopup.
🧹 Nitpick comments (1)
apps/portal/src/components/frame.styles.js (1)

516-525: Good button reset — consider adding cursor: pointer on the container too.

The reset properties correctly neutralize default button styling. However, cursor: pointer is only set on the child .gh-portal-closeicon (line 533), not on the button container itself. If there's any padding or hit-area around the icon, the cursor won't change to a pointer on the container edges. This is minor since padding: 0 currently eliminates gap, but it's a defensive addition.

Optional: add cursor: pointer
 .gh-portal-closeicon-container {
     background: none;
     border: none;
     padding: 0;
     margin: 0;
+    cursor: pointer;
     position: fixed;
     top: 24px;
     right: 24px;
     z-index: 10000;
 }

Comment on lines +16 to +20
<button className='gh-portal-closeicon-container' data-test-button='close-popup' onClick = {onClick || this.closePopup}>
<CloseIcon
className='gh-portal-closeicon' alt='Close' onClick = {onClick || this.closePopup} data-testid='close-popup'
/>
</div>
</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Several accessibility and correctness issues with the new button element.

  1. Missing type="button": Without an explicit type, buttons default to type="submit". Since CloseButton is rendered inside pages that contain <form> elements (e.g., offer-page signup), clicking close could trigger form submission.

  2. Duplicate onClick causes double invocation: The onClick handler is attached to both the <button> (line 16) and the child <CloseIcon> (line 18). Clicking the SVG fires its handler, then the event bubbles to the button, firing the same handler again. Remove the onClick from CloseIcon.

  3. Missing accessible name: The button has no text content and no aria-label. The alt='Close' on the SVG is not valid for SVG elements (only for <img>). Screen readers will announce this as an unlabeled button, which undermines the accessibility goal of this PR.

Proposed fix
-            <button className='gh-portal-closeicon-container' data-test-button='close-popup' onClick = {onClick || this.closePopup}>
+            <button type='button' className='gh-portal-closeicon-container' data-test-button='close-popup' aria-label='Close' onClick={onClick || this.closePopup}>
                 <CloseIcon
-                    className='gh-portal-closeicon' alt='Close' onClick = {onClick || this.closePopup} data-testid='close-popup'
+                    className='gh-portal-closeicon' aria-hidden='true' data-testid='close-popup'
                 />
             </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button className='gh-portal-closeicon-container' data-test-button='close-popup' onClick = {onClick || this.closePopup}>
<CloseIcon
className='gh-portal-closeicon' alt='Close' onClick = {onClick || this.closePopup} data-testid='close-popup'
/>
</div>
</button>
<button type='button' className='gh-portal-closeicon-container' data-test-button='close-popup' aria-label='Close' onClick={onClick || this.closePopup}>
<CloseIcon
className='gh-portal-closeicon' aria-hidden='true' data-testid='close-popup'
/>
</button>
🤖 Prompt for AI Agents
In `@apps/portal/src/components/common/close-button.js` around lines 16 - 20, The
CloseButton markup is causing accessibility and correctness problems: add
type="button" to the <button> element to prevent accidental form submits, remove
the duplicate onClick from the CloseIcon so the handler (onClick ||
this.closePopup) is only attached to the button, and provide an accessible name
by adding an aria-label (e.g., aria-label="Close") or visible text inside the
button so screen readers can announce it; keep the CloseIcon as a presentational
SVG (no alt prop) and ensure the button uses the existing onClick prop or
this.closePopup.

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.

1 participant