Skip to content

Commit b80c7b5

Browse files
cjw6kclaude
andcommitted
feat: Click backdrop to close modals
Added click-to-close on background scrim for main UI modals: - WelcomeModal - KeyboardShortcutsHelp - AboutPanel - TidalGlossary - HistoricalFacts Modal content has stopPropagation to prevent accidental closes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 143f863 commit b80c7b5

File tree

5 files changed

+40
-10
lines changed

5 files changed

+40
-10
lines changed

tidal-harmonics/src/components/ui/AboutPanel.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ export function AboutPanel() {
2626
}
2727

2828
return (
29-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
30-
<div className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[85vh] overflow-hidden flex flex-col">
29+
<div
30+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
31+
onClick={() => setIsOpen(false)}
32+
>
33+
<div
34+
className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[85vh] overflow-hidden flex flex-col"
35+
onClick={(e) => e.stopPropagation()}
36+
>
3137
{/* Header */}
3238
<div className="px-6 py-4 border-b border-slate-700 flex justify-between items-center">
3339
<h2 className="text-xl font-bold text-white">About Tidal Harmonics</h2>

tidal-harmonics/src/components/ui/HistoricalFacts.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,14 @@ export function HistoricalFacts({ onClose }: HistoricalFactsProps) {
177177
}, [selectedCategory]);
178178

179179
return (
180-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
181-
<div className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col">
180+
<div
181+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
182+
onClick={onClose}
183+
>
184+
<div
185+
className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col"
186+
onClick={(e) => e.stopPropagation()}
187+
>
182188
{/* Header */}
183189
<div className="px-6 py-4 border-b border-slate-700">
184190
<div className="flex justify-between items-center mb-3">

tidal-harmonics/src/components/ui/KeyboardShortcutsHelp.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ export function KeyboardShortcutsHelp() {
3030
}
3131

3232
return (
33-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
34-
<div className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-md w-full mx-4">
33+
<div
34+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
35+
onClick={() => setIsOpen(false)}
36+
>
37+
<div
38+
className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-md w-full mx-4"
39+
onClick={(e) => e.stopPropagation()}
40+
>
3541
<div className="px-6 py-4 border-b border-slate-700 flex justify-between items-center">
3642
<h2 className="text-lg font-bold text-white">Keyboard Shortcuts</h2>
3743
<button

tidal-harmonics/src/components/ui/TidalGlossary.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,14 @@ export function TidalGlossary({ onClose }: TidalGlossaryProps) {
290290
);
291291

292292
return (
293-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
294-
<div className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col">
293+
<div
294+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
295+
onClick={onClose}
296+
>
297+
<div
298+
className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col"
299+
onClick={(e) => e.stopPropagation()}
300+
>
295301
{/* Header */}
296302
<div className="px-6 py-4 border-b border-slate-700">
297303
<div className="flex justify-between items-center mb-3">

tidal-harmonics/src/components/ui/WelcomeModal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ export function WelcomeModal() {
2929
if (!isOpen) return null;
3030

3131
return (
32-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
33-
<div className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-md w-full mx-4 overflow-hidden">
32+
<div
33+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
34+
onClick={handleClose}
35+
>
36+
<div
37+
className="bg-slate-900 rounded-2xl shadow-2xl border border-slate-700 max-w-md w-full mx-4 overflow-hidden"
38+
onClick={(e) => e.stopPropagation()}
39+
>
3440
{/* Header */}
3541
<div className="px-6 py-4 border-b border-slate-700">
3642
<h2 className="text-xl font-bold text-white">Welcome to Tidal Harmonics!</h2>

0 commit comments

Comments
 (0)