🎨 Palette: Add explicit focus states and ARIA labels to section item buttons#520
🎨 Palette: Add explicit focus states and ARIA labels to section item buttons#520aafre wants to merge 1 commit into
Conversation
…buttons Added explicit focus-visible Tailwind classes and type="button" to item deletion buttons and addition buttons to improve keyboard navigability and prevent accidental form submissions. Co-authored-by: aafre <8656674+aafre@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request enhances accessibility and keyboard navigation by adding type="button" attributes and explicit focus-visible ring styles to action buttons across several components, including EducationItem, ExperienceItem, and GenericSection. Documentation was also updated to include these focus outline standards. Feedback suggests improving consistency by using the standard MdDelete icon for removal buttons, making removal handlers optional to allow for conditional rendering, and extracting repeated Tailwind focus classes into a shared constant to reduce duplication.
| className="text-red-600 hover:text-red-800 p-2 hover:bg-red-50 rounded-lg transition-colors flex-shrink-0 mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-1" | ||
| title="Remove description point" | ||
| aria-label="Remove description point" | ||
| > | ||
| ✕ |
There was a problem hiding this comment.
The removal button for description points is inconsistent with other removal buttons in the application. It should use the MdDelete icon and standard styling. To align with repository rules, ensure the removal handler prop is optional and the button is conditionally rendered only when the prop is provided. Additionally, consider extracting the repeated focus ring classes to a shared constant to avoid data duplication.
| className="text-red-600 hover:text-red-800 p-2 hover:bg-red-50 rounded-lg transition-colors flex-shrink-0 mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-1" | |
| title="Remove description point" | |
| aria-label="Remove description point" | |
| > | |
| ✕ | |
| className="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors flex-shrink-0 mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-1" | |
| title="Remove description point" | |
| aria-label="Remove description point" | |
| > | |
| <MdDelete className="text-xl" /> |
References
- For optional UI elements like a delete button, make the corresponding handler prop (e.g., onDelete) optional and conditionally render the element only when the prop is provided.
- To avoid data duplication, import shared constants from a single source of truth and map over them to add component-specific metadata if needed.
| type="button" | ||
| onClick={() => handleRemoveItem(index)} | ||
| className="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors flex-shrink-0" | ||
| className="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors flex-shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-1" |
There was a problem hiding this comment.
The focus ring classes (focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-1) are repeated identically across multiple buttons. To improve maintainability and avoid data duplication, consider extracting these shared Tailwind classes into a single source of truth (e.g., a shared constant), as per the repository rules.
References
- To avoid data duplication, import shared constants from a single source of truth and map over them to add component-specific metadata if needed.
|
Closing duplicate — the most recent version of this change is PR #524. |
Understood. Acknowledging that this work is a duplicate and stopping work on this task. |
What: Added explicit focus-visible Tailwind classes (
focus-visible:ring-2 focus-visible:ring-offset-1, etc.) andtype="button"to item deletion buttons inExperienceItem.tsx,EducationItem.tsx, andGenericSection.tsx. Also added these to the description point removal and addition buttons inExperienceItem.tsx.Why: Inline removal/addition controls inside dynamically mapped lists were losing default browser focus outlines due to custom Tailwind padding and colors, making keyboard navigation difficult for users relying on screen readers or keyboard navigation.
Before/After: The buttons now show clear focus rings when navigating via keyboard (red for destructive actions, accent color for additive actions).
Accessibility: Improved keyboard navigability by ensuring focus visibility. Added explicit
type="button"to prevent accidental form submissions, andaria-labels for screen reader accessibility on icon-only buttons (like the✕description point removal button).PR created automatically by Jules for task 541238815875527125 started by @aafre