Skip to content

Commit 9200f86

Browse files
committed
push custom handling to radix - keep modifier logic
1 parent 0de061c commit 9200f86

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/components/imageLightbox/index.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,12 @@ export function ImageLightbox({
7777
};
7878

7979
const handleKeyDown = (e: React.KeyboardEvent) => {
80-
if (e.key === 'Enter' || e.key === ' ') {
81-
if (e.ctrlKey || e.metaKey) {
82-
e.preventDefault();
83-
e.stopPropagation();
84-
openInNewTab();
85-
return;
86-
}
87-
// Regular Enter/Space should open lightbox
80+
// Only handle Ctrl/Cmd+Enter/Space for opening in new tab
81+
// Radix UI Dialog.Trigger handles regular Enter/Space automatically
82+
if ((e.key === 'Enter' || e.key === ' ') && (e.ctrlKey || e.metaKey)) {
8883
e.preventDefault();
89-
setOpen(true);
84+
e.stopPropagation();
85+
openInNewTab();
9086
}
9187
};
9288

@@ -140,8 +136,6 @@ export function ImageLightbox({
140136
onKeyDown={handleKeyDown}
141137
className="cursor-pointer border-none bg-transparent p-0 block w-full no-underline"
142138
aria-label={`View image: ${alt}`}
143-
role="button"
144-
tabIndex={0}
145139
>
146140
{renderImage()}
147141
</div>

0 commit comments

Comments
 (0)