Skip to content

Commit 0483b96

Browse files
Retsommclaude
andcommitted
fix(pwa): safe-area insets for toolbar/bottom bar + annotation swipe guard
- Toolbar: wrap with paddingTop env(safe-area-inset-top) so content sits below iOS status bar when viewport-fit=cover is active - Bottom progress bar: wrap with paddingBottom env(safe-area-inset-bottom) so bar stays above Home indicator; restore 32px inner content height - onTouchEnd: check isSelectingRef before page turn to prevent accidental swipe navigation when user is selecting text for annotation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e379c47 commit 0483b96

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

pwa/src/components/Toolbar.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,13 @@ const Toolbar = ({
203203

204204
return (
205205
<div style={{
206-
display: 'flex', alignItems: 'center', gap: 2, padding: '0 10px',
207-
height: 56, borderBottom: `1px solid ${borderCol}`,
208206
background: paperBg, flexShrink: 0,
207+
borderBottom: `1px solid ${borderCol}`,
208+
paddingTop: 'env(safe-area-inset-top)',
209+
}}>
210+
<div style={{
211+
display: 'flex', alignItems: 'center', gap: 2, padding: '0 10px',
212+
height: 56,
209213
}}>
210214
{/* 左:返回 + 書名作者(固定寬度區塊) */}
211215
<div style={{ display: 'flex', alignItems: 'center', gap: 4, flexShrink: 0 }}>
@@ -312,6 +316,7 @@ const Toolbar = ({
312316
{btn(false, onToggleDark, darkMode ? <IconSun /> : <IconMoon />, darkMode ? '切換淺色模式' : '切換深色模式')}
313317
</div>
314318
</div>
319+
</div>
315320
)
316321
}
317322

pwa/src/page/Reader.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,7 @@ const Reader = ({ bookPath, bookId, bookRecord, getCoverDataUrl, onBack, darkMod
19081908
const dy = e.changedTouches[0].clientY - start.y
19091909
swipeStartRef.current = null
19101910
if (Math.abs(dx) < 50 || Math.abs(dx) < Math.abs(dy) * 1.5) return
1911+
if (isSelectingRef.current) return
19111912
const isRtl = readingDirectionRef.current === 'rtl'
19121913
if ((dx < 0) !== isRtl) nextPageRef.current()
19131914
else prevPageRef.current()
@@ -2252,12 +2253,17 @@ const Reader = ({ bookPath, bookId, bookRecord, getCoverDataUrl, onBack, darkMod
22522253

22532254
{/* 手機版底部進度列 — 永遠佔位避免 epub 初始化尺寸錯誤 */}
22542255
<div
2255-
className="flex md:hidden items-center"
2256+
className="md:hidden"
22562257
style={{
2257-
height: 32, flexShrink: 0, gap: 10, padding: '0 16px',
2258+
flexShrink: 0,
22582259
borderTop: `1px solid ${darkMode ? '#3a3430' : '#e4ddd0'}`,
22592260
background: darkMode ? '#1a1816' : '#f9f7f2',
2261+
paddingBottom: 'env(safe-area-inset-bottom)',
22602262
}}
2263+
>
2264+
<div
2265+
className="flex items-center"
2266+
style={{ height: 32, gap: 10, padding: '0 16px' }}
22612267
>
22622268
{ready && displayPageInfo && (
22632269
<>
@@ -2273,6 +2279,7 @@ const Reader = ({ bookPath, bookId, bookRecord, getCoverDataUrl, onBack, darkMod
22732279
</>
22742280
)}
22752281
</div>
2282+
</div>
22762283
</div>
22772284
)
22782285
}

0 commit comments

Comments
 (0)