Skip to content

Commit be59728

Browse files
yoyo837claude
andcommitted
fix: remove stopImmediatePropagation to allow Portal stack to handle Dialog ESC
Portal's onGlobalKeyDown uses a stack with top-check to prevent Dialog from closing when Preview is on top. stopImmediatePropagation was blocking this mechanism entirely, causing Dialog's onClose to never fire on second ESC. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ad02d5d commit be59728

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Preview/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ const Preview: React.FC<PreviewProps> = props => {
334334

335335
if (keyCode === KeyCode.ESC || key === 'Escape') {
336336
event.preventDefault();
337-
event.stopImmediatePropagation();
338337
onClose?.();
339338
return;
340339
}
@@ -351,10 +350,10 @@ const Preview: React.FC<PreviewProps> = props => {
351350

352351
useEffect(() => {
353352
if (open) {
354-
window.addEventListener('keydown', onKeyDown, true);
353+
window.addEventListener('keydown', onKeyDown);
355354

356355
return () => {
357-
window.removeEventListener('keydown', onKeyDown, true);
356+
window.removeEventListener('keydown', onKeyDown);
358357
};
359358
}
360359
}, [open]);

0 commit comments

Comments
 (0)