diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..1cef59a --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2024-03-XX - Lightbox Accessibility +**Learning:** Found that Lightbox overlay has good keyboard navigation (esc/left/right) but lacked tooltip hints for those controls and lacked a shortcut for EXIF data toggle. +**Action:** Added `i` shortcut and `title` attributes on interactive elements in Lightbox. diff --git a/components/Lightbox.tsx b/components/Lightbox.tsx index 39ce916..a036cc1 100644 --- a/components/Lightbox.tsx +++ b/components/Lightbox.tsx @@ -76,6 +76,17 @@ export function Lightbox({ assets, currentIndex, onClose, onNext, onPrev }: Ligh onSwipeRight: onPrev, }); + // Listen for 'i' key to toggle EXIF + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === 'i' || e.key === 'I') { + handleExifToggle(); + } + }; + document.addEventListener('keydown', handleKeyDown); + return () => document.removeEventListener('keydown', handleKeyDown); + }, [handleExifToggle]); + // Click on overlay background → close const handleOverlayClick = useCallback( (e: React.MouseEvent) => { @@ -95,7 +106,7 @@ export function Lightbox({ assets, currentIndex, onClose, onNext, onPrev }: Ligh onTouchEnd={handleTouchEnd} > {/* Close button */} -