Skip to content

🎨 Palette: Improve ImageUploader accessibility and keyboard navigation#59

Open
MacTechIN wants to merge 1 commit into
mainfrom
palette-imageuploader-a11y-12000132981347354190
Open

🎨 Palette: Improve ImageUploader accessibility and keyboard navigation#59
MacTechIN wants to merge 1 commit into
mainfrom
palette-imageuploader-a11y-12000132981347354190

Conversation

@MacTechIN

Copy link
Copy Markdown
Owner

💡 What: Improved accessibility and keyboard navigation in the ImageUploader component. Added clear focus rings to interactive elements, replaced tooltip attributes with semantic ARIA labels, and hid decorative SVG icons from screen readers.

🎯 Why: Users navigating via keyboard need clear visual indicators of which element is focused. Screen reader users rely on semantic descriptions rather than visual tooltips, and redundant information (like reading an icon after its label) should be avoided.

📸 Before/After: Focus rings are now clearly visible on the "Select File" and "Remove image" buttons.

♿ Accessibility:

  • Added focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none to buttons.
  • Replaced the title attribute with aria-label on the icon-only "Remove image" button.
  • Added aria-hidden="true" to the X icon inside the "Remove image" button.

PR created automatically by Jules for task 12000132981347354190 started by @MacTechIN

- Added `focus-visible` styles to 'Select File' and 'Remove image' buttons for better keyboard navigation.
- Replaced the `title` attribute with `aria-label` on the 'Remove image' button.
- Added `aria-hidden="true"` to the internal `X` icon of the 'Remove image' button.

Co-authored-by: MacTechIN <63564804+MacTechIN@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request improves the accessibility and keyboard navigation of the ImageUploader component by adding focus-visible rings, replacing the title attribute with aria-label on the remove button, and hiding the icon from screen readers. The reviewer recommends explicitly setting type="button" on both buttons to prevent accidental form submissions, and retaining the title attribute alongside aria-label on the remove button to preserve the visual tooltip for sighted users.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

<button
onClick={() => fileInputRef.current?.click()}
className="px-3 sm:px-4 py-2 text-sm bg-blue-500 text-white rounded-lg hover:bg-blue-600 active:scale-95 transition-all"
className="px-3 sm:px-4 py-2 text-sm bg-blue-500 text-white rounded-lg hover:bg-blue-600 active:scale-95 transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500 focus-visible:outline-none"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

By default, <button> elements inside a <form> behave as submit buttons. To prevent accidental form submissions when this component is used inside a form, it is recommended to explicitly set type="button".

            className="px-3 sm:px-4 py-2 text-sm bg-blue-500 text-white rounded-lg hover:bg-blue-600 active:scale-95 transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500 focus-visible:outline-none"
            type="button"

Comment on lines +112 to +113
className="absolute top-2 right-2 p-1.5 sm:p-2 bg-red-500 text-white rounded-full hover:bg-red-600 active:scale-95 transition-all shadow-lg focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-red-500 focus-visible:outline-none"
aria-label={t('removeImage')}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Replacing the title attribute entirely with aria-label removes the visual tooltip for sighted mouse and keyboard users. For icon-only buttons, keeping both title (for visual tooltips) and aria-label (for screen readers) provides the best user experience. Additionally, explicitly setting type="button" prevents accidental form submissions.

            type="button"
            className="absolute top-2 right-2 p-1.5 sm:p-2 bg-red-500 text-white rounded-full hover:bg-red-600 active:scale-95 transition-all shadow-lg focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-red-500 focus-visible:outline-none"
            title={t('removeImage')}
            aria-label={t('removeImage')}

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