Skip to content

Commit 0d5433b

Browse files
committed
fix: address PR review findings on mobile responsive layout
- Remove maximum-scale=1 from viewport meta to allow pinch-to-zoom (WCAG 2.1) - Wrap sessionStorage access in try/catch for privacy-restricted contexts - Add Escape key to dismiss desktop tip modal (consistent with demo gallery) - Change tip modal breakpoint from md:hidden to sm:hidden to match layout
1 parent fd16303 commit 0d5433b

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

apps/app/src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function RootLayout({children}: Readonly<{ children: React.ReactN
1010
return (
1111
<html lang="en">
1212
<head>
13-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
13+
<meta name="viewport" content="width=device-width, initial-scale=1" />
1414
<title>Open Generative UI</title>
1515
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🪁</text></svg>" />
1616
<link rel="preconnect" href="https://fonts.googleapis.com" />

apps/app/src/components/desktop-tip-modal.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useSyncExternalStore } from "react";
3+
import { useEffect, useSyncExternalStore } from "react";
44

55
const DISMISSED_KEY = "desktop-tip-dismissed";
66

@@ -17,21 +17,34 @@ export function DesktopTipModal() {
1717
listeners = listeners.filter((l) => l !== listener);
1818
};
1919
},
20-
() => !sessionStorage.getItem(DISMISSED_KEY),
20+
() => {
21+
try { return !sessionStorage.getItem(DISMISSED_KEY); }
22+
catch { return false; }
23+
},
2124
() => false,
2225
);
2326

24-
if (!notDismissed) return null;
25-
2627
const dismiss = () => {
27-
sessionStorage.setItem(DISMISSED_KEY, "1");
28+
try { sessionStorage.setItem(DISMISSED_KEY, "1"); }
29+
catch { /* privacy-restricted context */ }
2830
emitChange();
2931
};
3032

33+
useEffect(() => {
34+
if (!notDismissed) return;
35+
const handleKeyDown = (e: KeyboardEvent) => {
36+
if (e.key === "Escape") dismiss();
37+
};
38+
document.addEventListener("keydown", handleKeyDown);
39+
return () => document.removeEventListener("keydown", handleKeyDown);
40+
});
41+
42+
if (!notDismissed) return null;
43+
3144
return (
3245
<div
3346
onClick={dismiss}
34-
className="fixed inset-0 z-[9999] flex items-center justify-center p-6 md:hidden"
47+
className="fixed inset-0 z-[9999] flex items-center justify-center p-6 sm:hidden"
3548
style={{
3649
background: "rgba(0,0,0,0.45)",
3750
backdropFilter: "blur(6px)",
@@ -50,7 +63,7 @@ export function DesktopTipModal() {
5063
padding: "32px 28px",
5164
maxWidth: 340,
5265
width: "100%",
53-
textAlign: "center" as const,
66+
textAlign: "center",
5467
fontFamily: "var(--font-family)",
5568
}}
5669
>

0 commit comments

Comments
 (0)