Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-02-15 - [Absolute Positioned Buttons in Overflow-Hidden Containers]
**Learning:** Keyboard focus rings on absolute positioned interactive elements (like overlay action buttons) within `overflow-hidden` containers can frequently get clipped, degrading visibility for keyboard users.
**Action:** Always combine standard focus-visible classes (`focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none`) with a shadow property (e.g., `shadow-lg`) or sufficient internal padding to ensure the focus ring remains fully visible. Adapt ring colors logically to the action context (e.g., destructive actions like 'Remove' should use red).

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

The action item suggests combining focus-visible classes with a shadow property (like shadow-lg) to prevent focus ring clipping in overflow-hidden containers. However, in CSS/Tailwind, both shadow and ring utilities are implemented using box-shadow, which will both be clipped by overflow: hidden if they extend beyond the container's boundary.

In the implementation of ImageUploader.tsx, the focus ring is not clipped because the absolute-positioned button is placed as a sibling outside of the overflow-hidden container (inside the parent relative wrapper), which is the correct way to avoid clipping.

Consider updating this learning note to clarify that placing the interactive element outside the overflow-hidden container (or adding sufficient padding/margins to the container) is what actually prevents clipping, rather than adding a shadow.

Suggested change
**Action:** Always combine standard focus-visible classes (`focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none`) with a shadow property (e.g., `shadow-lg`) or sufficient internal padding to ensure the focus ring remains fully visible. Adapt ring colors logically to the action context (e.g., destructive actions like 'Remove' should use red).
**Action:** Always place absolute positioned interactive elements (like overlay action buttons) outside of the overflow-hidden container (e.g., as a sibling inside a shared relative parent) or ensure the container has sufficient padding so that standard focus-visible classes (focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none) remain fully visible. Adapt ring colors logically to the action context (e.g., destructive actions like 'Remove' should use red).

7 changes: 4 additions & 3 deletions src/components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function ImageUploader({ onImageLoad, currentImage, onClear }: ImageUploa
<p className="text-xs text-gray-500 mb-3 sm:mb-4">{t('supportedFormats')}</p>
<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:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500"
>
{t('selectFile')}
</button>
Expand All @@ -109,10 +109,11 @@ export function ImageUploader({ onImageLoad, currentImage, onClear }: ImageUploa
</div>
<button
onClick={onClear}
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"
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:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-red-500"
title={t('removeImage')}
aria-label={t('removeImage')}
>
<X size={16} className="sm:w-5 sm:h-5" />
<X size={16} className="sm:w-5 sm:h-5" aria-hidden="true" />
</button>
</div>
)}
Expand Down