Skip to content

Commit 867b1dd

Browse files
feat: make asset library remove button keyboard accessible
Co-authored-by: thebearwithabite <216692431+thebearwithabite@users.noreply.github.com>
1 parent 613e4ba commit 867b1dd

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.jules/palette.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
## 2024-03-16 - Make hover-only actions keyboard accessible
22
**Learning:** Actions hidden behind `opacity-0` and revealed with `group-hover:opacity-100` are completely inaccessible to keyboard-only users navigating via Tab. This is a common pattern for "secondary" actions like undo/delete buttons in lists.
33
**Action:** When using `opacity-0 group-hover:opacity-100` to hide secondary actions, always pair it with `focus-visible:opacity-100`, `focus-visible:ring-2`, and `focus-visible:outline-none` to ensure the action becomes visible and clearly highlighted when focused via keyboard navigation.
4+
5+
## 2024-04-17 - Extend keyboard accessibility to all hover-revealed elements
6+
**Learning:** In addition to lists, interactive elements revealed only on hover within cards and library components (like copy buttons and upload actions) must also receive keyboard accessibility features. Otherwise, they remain invisible and unusable for screen reader and keyboard-only users.
7+
**Action:** Apply `focus-visible:opacity-100`, `focus-visible:scale-100`, `focus-visible:translate-y-0`, `focus-visible:ring-2`, and `focus-visible:outline-none` (matching existing hover transitions) to all hidden actionable elements. Also add `aria-label`s to icon-only buttons.
8+
9+
## 2024-04-17 - Keyboard accessible liquid glass buttons
10+
**Learning:** Visually hidden icon-only buttons (using `opacity-0 scale-90 group-hover:opacity-100 group-hover:scale-100`) are inaccessible to keyboard users and lack semantic meaning for screen readers.
11+
**Action:** Pair hover visibility classes with explicit `focus-visible:opacity-100 focus-visible:scale-100` and standard focus rings (`focus-visible:ring-2 focus-visible:ring-background/50 focus-visible:outline-none`) alongside an `aria-label` to be fully keyboard accessible.

frontend_v2/src/components/veo/AssetLibrary.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ const AssetCard = ({ asset, onRemove, onUpload }: AssetCardProps) => {
237237
<button
238238
onClick={onRemove}
239239
type="button"
240-
className="absolute top-2 right-2 z-20 bg-black/60 backdrop-blur-md text-white/60 hover:text-white rounded-full p-1.5 opacity-0 group-hover:opacity-100 transition-all border border-white/10 scale-90 group-hover:scale-100">
241-
<XMarkIcon className="w-3 h-3" />
240+
aria-label="Remove asset"
241+
className="absolute top-2 right-2 z-20 bg-black/60 backdrop-blur-md text-white/60 hover:text-white rounded-full p-1.5 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 focus-visible:scale-100 focus-visible:ring-2 focus-visible:ring-background/50 focus-visible:outline-none transition-all border border-white/10 scale-90 group-hover:scale-100">
242+
<XMarkIcon className="w-3 h-3" aria-hidden="true" />
242243
</button>
243244

244245
<div className="aspect-[4/3] bg-black/40 relative overflow-hidden">

0 commit comments

Comments
 (0)