-
Notifications
You must be signed in to change notification settings - Fork 15
🎨 Palette: Add ARIA labels and focus states to modal close buttons #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 2025-02-14 - ResponsiveConfirmDialog for Destructive Actions | ||
| **Learning:** Destructive actions (like Delete) implemented with custom hardcoded modals lack standard accessibility attributes (`role="dialog"`, `aria-modal`, etc.) and mobile responsiveness (like bottom sheets). This app has a `ResponsiveConfirmDialog` component designed specifically for this purpose, but it was not being utilized uniformly. | ||
| **Action:** Always use `ResponsiveConfirmDialog` for destructive confirmation prompts (such as `DeleteResumeModal`) to ensure a consistent, accessible, and mobile-friendly UX that prevents accidental data loss. | ||
|
|
||
| ## 2024-05-03 - Accessible Modal Close Buttons | ||
| **Learning:** Custom modals using React portals often have custom header implementations where icon-only close buttons lack both accessible names (`aria-label`) and visible focus states, which breaks keyboard navigation and screen reader experience. | ||
| **Action:** Always ensure custom modal close buttons include `aria-label="Close modal"` and explicit focus states like `focus-visible:ring-2 focus-visible:ring-accent` using Tailwind. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,8 @@ export function UploadResumeModal({ | |
| </div> | ||
| <button | ||
| onClick={handleCloseModal} | ||
| className="text-white/80 hover:text-white transition-colors" | ||
| className="text-white/80 hover:text-white transition-colors rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50" | ||
| aria-label="Close modal" | ||
|
Comment on lines
+102
to
+103
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To ensure accessibility, this modal must implement a focus trap so that keyboard focus remains within the modal while it is open. The close button should also explicitly set type='button' to avoid unintended form submissions. For consistency and usability, add padding and a hover background to increase the hit target, and use focus-visible:ring-accent as per the repository's palette guidelines. References
|
||
| > | ||
| <XMarkIcon className="w-6 h-6" /> | ||
| </button> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The close button in this modal should be updated for accessibility and consistency. For accessibility, this modal must implement a focus trap to ensure keyboard focus remains within the modal's focusable elements while it is open. Additionally, explicitly set type='button' on the button element to prevent unintended form submissions. Styling improvements like adding padding (p-2) and a hover background (hover:bg-gray-100) will improve the hit target size, and using text-gray-500 ensures it meets WCAG 2.1 contrast standards.
References