Skip to content

Commit f15d5f3

Browse files
authored
fix: resolve mobile menu issues, responsiveness, and routing errors (#60)
- Fix mobile menu auto-closing by removing conflicting event handlers - Remove global document listeners (mousedown/touchstart) that caused double-toggling - Simplify toggle logic to use single onclick handler - Remove unnecessary preventDefault/stopPropagation calls - Move menu outside nav element to prevent overflow clipping - Improve mobile responsiveness across components - Add overflow-x: hidden to html, body, and main elements - Fix horizontal scrolling issues on mobile devices - Adjust container widths and padding for mobile breakpoints - Fix HowItWorks section code blocks to wrap properly on small screens - Ensure navbar and mobile menu respect viewport constraints - Fix 404 error on /docs page reload - Add fallback: 'index.html' to adapter-static configuration - Enables client-side routing for static builds on Vercel - Fix 500 error from Svelte 5 syntax incompatibility - Remove mixed event handler syntax (on:touchstart) - Use consistent Svelte 5 event handler format - Update build output directory to 'dist' for Vercel compatibility - Change from 'build' to 'dist' in svelte.config.js - Update .gitignore to include dist directory
1 parent 090be30 commit f15d5f3

7 files changed

Lines changed: 165 additions & 30 deletions

File tree

web/src/app.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ body {
139139
-moz-osx-font-smoothing: grayscale;
140140
transition: background-color var(--transition-base), color var(--transition-base);
141141
position: relative;
142+
overflow-x: hidden;
143+
max-width: 100vw;
142144
}
143145

144146
body::before {
@@ -181,6 +183,7 @@ code, pre {
181183
max-width: var(--max-width);
182184
margin: 0 auto;
183185
padding: 0 24px;
186+
box-sizing: border-box;
184187
}
185188

186189
@media (max-width: 640px) {
@@ -189,6 +192,17 @@ code, pre {
189192
}
190193
}
191194

195+
/* Prevent horizontal overflow */
196+
html, body {
197+
overflow-x: hidden;
198+
max-width: 100vw;
199+
}
200+
201+
main {
202+
overflow-x: hidden;
203+
max-width: 100%;
204+
}
205+
192206
/* ---- Typography Scale ---- */
193207
h1, h2, h3, h4, h5, h6 {
194208
line-height: 1.1;

web/src/lib/components/Hero.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
align-items: center;
7979
gap: 40px;
8080
padding: 0 24px;
81+
width: 100%;
82+
max-width: 100%;
83+
box-sizing: border-box;
8184
}
8285
8386
.badge {
@@ -257,6 +260,10 @@
257260
padding-bottom: 56px;
258261
}
259262
263+
.hero-inner {
264+
padding: 0 16px;
265+
}
266+
260267
.hero-br {
261268
display: none;
262269
}
@@ -274,5 +281,10 @@
274281
.terminal-body {
275282
padding: 12px;
276283
}
284+
285+
.hero-terminal {
286+
max-width: 100%;
287+
margin: 0 8px;
288+
}
277289
}
278290
</style>

web/src/lib/components/HowItWorks.svelte

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
max-width: 440px;
6464
margin: 16px auto 0;
6565
font-size: 1.05rem;
66+
padding: 0 16px;
67+
box-sizing: border-box;
6668
}
6769
6870
.steps-grid {
@@ -80,6 +82,10 @@
8082
border: 1px solid var(--border-secondary);
8183
border-radius: var(--radius-md);
8284
transition: border-color var(--transition-fast);
85+
width: 100%;
86+
max-width: 100%;
87+
box-sizing: border-box;
88+
overflow: hidden;
8389
}
8490
8591
.step-card:hover {
@@ -111,18 +117,28 @@
111117
border: 1px solid var(--code-border);
112118
border-radius: var(--radius-sm);
113119
overflow-x: auto;
120+
overflow-y: hidden;
121+
width: 100%;
122+
max-width: 100%;
123+
box-sizing: border-box;
124+
-webkit-overflow-scrolling: touch;
114125
}
115126
116127
.step-command code {
117128
font-size: 0.78rem;
118129
color: var(--code-text);
119-
white-space: nowrap;
130+
white-space: pre;
131+
display: block;
132+
word-break: break-word;
133+
overflow-wrap: break-word;
120134
}
121135
122136
.step-description {
123137
font-size: 0.875rem;
124138
line-height: 1.65;
125139
color: var(--text-secondary);
140+
word-wrap: break-word;
141+
overflow-wrap: break-word;
126142
}
127143
128144
@media (max-width: 1024px) {
@@ -131,20 +147,42 @@
131147
gap: 16px;
132148
max-width: 520px;
133149
margin: 0 auto;
150+
width: 100%;
134151
}
135152
}
136153
137154
@media (max-width: 640px) {
138155
.how-it-works {
139156
padding: 64px 0;
157+
overflow-x: hidden;
140158
}
141159
142160
.section-header {
143161
margin-bottom: 40px;
162+
padding: 0 16px;
144163
}
145164
146165
.step-card {
147-
padding: 22px;
166+
padding: 20px 16px;
167+
min-width: 0;
168+
}
169+
170+
.step-command {
171+
padding: 8px 10px;
172+
}
173+
174+
.step-command code {
175+
font-size: 0.7rem;
176+
white-space: pre-wrap;
177+
word-break: break-all;
178+
}
179+
180+
.step-title {
181+
font-size: 1.1rem;
182+
}
183+
184+
.step-description {
185+
font-size: 0.8rem;
148186
}
149187
}
150188
</style>

web/src/lib/components/Logo.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
align-items: center;
2222
gap: 8px;
2323
text-decoration: none;
24+
flex-shrink: 0;
25+
min-width: 0;
2426
}
2527
2628
.logo-text {

web/src/lib/components/Navbar.svelte

Lines changed: 77 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
1414
function closeMobile() {
1515
mobileOpen = false;
16+
document.body.style.overflow = '';
17+
}
18+
19+
function toggleMobile() {
20+
mobileOpen = !mobileOpen;
21+
document.body.style.overflow = mobileOpen ? 'hidden' : '';
1622
}
1723
</script>
1824

@@ -34,9 +40,10 @@
3440

3541
<button
3642
class="mobile-toggle mobile-only"
37-
onclick={() => mobileOpen = !mobileOpen}
43+
onclick={toggleMobile}
3844
aria-label="Toggle menu"
3945
aria-expanded={mobileOpen}
46+
type="button"
4047
>
4148
{#if mobileOpen}
4249
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
@@ -50,21 +57,21 @@
5057
</button>
5158
</div>
5259
</div>
60+
</nav>
5361

54-
{#if mobileOpen}
55-
<div class="mobile-menu mobile-only">
56-
<div class="mobile-menu-inner">
57-
{#each navLinks as link}
58-
<a href={link.href} class="mobile-link" onclick={closeMobile}>{link.label}</a>
59-
{/each}
60-
<hr />
61-
<a href="/docs#installation" class="btn btn-primary mobile-cta">
62-
Get Started
63-
</a>
64-
</div>
62+
{#if mobileOpen}
63+
<div class="mobile-menu">
64+
<div class="mobile-menu-inner">
65+
{#each navLinks as link}
66+
<a href={link.href} class="mobile-link" onclick={closeMobile}>{link.label}</a>
67+
{/each}
68+
<hr />
69+
<a href="/docs#installation" class="btn btn-primary mobile-cta">
70+
Get Started
71+
</a>
6572
</div>
66-
{/if}
67-
</nav>
73+
</div>
74+
{/if}
6875

6976
<style>
7077
.navbar {
@@ -78,13 +85,19 @@
7885
-webkit-backdrop-filter: blur(12px);
7986
border-bottom: 1px solid var(--nav-border);
8087
height: var(--nav-height);
88+
width: 100%;
89+
max-width: 100vw;
90+
overflow: visible;
8191
}
8292
8393
.navbar-inner {
8494
display: flex;
8595
align-items: center;
8696
justify-content: space-between;
8797
height: 100%;
98+
width: 100%;
99+
max-width: 100%;
100+
overflow: hidden;
88101
}
89102
90103
.nav-links {
@@ -111,6 +124,7 @@
111124
display: flex;
112125
align-items: center;
113126
gap: 8px;
127+
flex-shrink: 0;
114128
}
115129
116130
.btn {
@@ -140,30 +154,53 @@
140154
justify-content: center;
141155
width: 36px;
142156
height: 36px;
157+
min-width: 36px;
143158
color: var(--text-secondary);
144159
border-radius: var(--radius-sm);
160+
flex-shrink: 0;
161+
cursor: pointer;
145162
}
146163
147164
.mobile-toggle:hover {
148165
background: var(--bg-tertiary);
149166
}
150167
151168
.mobile-menu {
152-
position: fixed;
153-
top: var(--nav-height);
154-
left: 0;
155-
right: 0;
156-
bottom: 0;
157-
background: var(--bg-primary);
158-
z-index: 99;
159-
overflow-y: auto;
169+
position: fixed !important;
170+
top: var(--nav-height) !important;
171+
left: 0 !important;
172+
right: 0 !important;
173+
bottom: 0 !important;
174+
background: var(--bg-primary) !important;
175+
z-index: 999 !important;
176+
overflow-y: auto !important;
177+
overflow-x: hidden !important;
178+
width: 100vw !important;
179+
max-width: 100vw !important;
180+
-webkit-overflow-scrolling: touch;
181+
display: block !important;
182+
visibility: visible !important;
183+
opacity: 1 !important;
184+
margin: 0 !important;
185+
padding: 0 !important;
186+
}
187+
188+
/* Hide on desktop */
189+
@media (min-width: 769px) {
190+
.mobile-menu {
191+
display: none !important;
192+
}
160193
}
161194
162195
.mobile-menu-inner {
163-
display: flex;
164-
flex-direction: column;
165-
padding: 16px;
166-
gap: 4px;
196+
display: flex !important;
197+
flex-direction: column !important;
198+
padding: 16px !important;
199+
gap: 4px !important;
200+
width: 100% !important;
201+
max-width: 100% !important;
202+
box-sizing: border-box !important;
203+
min-height: 200px !important;
167204
}
168205
169206
.mobile-link {
@@ -173,6 +210,8 @@
173210
color: var(--text-secondary);
174211
border-radius: var(--radius-sm);
175212
transition: background var(--transition-fast);
213+
display: block;
214+
text-decoration: none;
176215
}
177216
178217
.mobile-link:hover {
@@ -201,12 +240,24 @@
201240
}
202241
203242
@media (max-width: 768px) {
243+
.navbar-inner {
244+
padding: 0 12px;
245+
}
246+
204247
.desktop-only {
205248
display: none !important;
206249
}
207250
208251
.mobile-only {
209252
display: flex;
210253
}
254+
255+
.mobile-menu {
256+
display: block !important;
257+
}
258+
259+
.nav-actions {
260+
gap: 4px;
261+
}
211262
}
212263
</style>

0 commit comments

Comments
 (0)