Skip to content

fix(reader): 關閉 iOS Safari text autosizing 避免 PWA 內文異常放大 - #21

Merged
Retsomm merged 1 commit into
mainfrom
dev
Jul 31, 2026
Merged

fix(reader): 關閉 iOS Safari text autosizing 避免 PWA 內文異常放大#21
Retsomm merged 1 commit into
mainfrom
dev

Conversation

@Retsomm

@Retsomm Retsomm commented Jul 31, 2026

Copy link
Copy Markdown
Owner

iOS Safari(含 standalone PWA)的 text autosizing 機制會依欄寬/裝置寬比例 在渲染時額外放大文字,不反映在 getComputedStyle().fontSize,既有的
inline font-size 覆寫蓋不掉。epub.js 分頁排版是窄欄 CSS columns,特別 容易觸發。注入 text-size-adjust: 100% 關閉此行為。

Summary by CodeRabbit

  • Bug Fixes
    • Fixed text auto-sizing behavior on iOS Safari when reading EPUB documents to ensure consistent text display across devices.

iOS Safari(含 standalone PWA)的 text autosizing 機制會依欄寬/裝置寬比例
在渲染時額外放大文字,不反映在 getComputedStyle().fontSize,既有的
inline font-size 覆寫蓋不掉。epub.js 分頁排版是窄欄 CSS columns,特別
容易觸發。注入 text-size-adjust: 100% 關閉此行為。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
travel-in-time Ready Ready Preview Jul 31, 2026 1:42pm

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 300b392e-1c41-423e-923d-29ee1edd3451

📥 Commits

Reviewing files that changed from the base of the PR and between cb87a63 and 891e654.

📒 Files selected for processing (2)
  • pwa-next/src/components/Reader/readerStyles.ts
  • pwa-next/src/hooks/reader/useReaderEngine.ts

📝 Walkthrough

Walkthrough

The reader adds applyTextSizeAdjustOverride and invokes it for each loaded EPUB content document. The helper sets standard and WebKit text-size adjustment to 100% on the document and its descendants.

Changes

Reader text-size adjustment override

Layer / File(s) Summary
Apply text-size adjustment override
pwa-next/src/components/Reader/readerStyles.ts, pwa-next/src/hooks/reader/useReaderEngine.ts
The reader-style helper injects standard and WebKit CSS rules. The reader engine applies the helper during EPUB document initialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant useReaderEngine
  participant EPUBContentDocument
  participant applyTextSizeAdjustOverride
  useReaderEngine->>EPUBContentDocument: Initialize loaded EPUB content
  useReaderEngine->>applyTextSizeAdjustOverride: Apply override to document
  applyTextSizeAdjustOverride->>EPUBContentDocument: Inject text-size-adjust CSS
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes disabling iOS Safari text autosizing to prevent abnormal text enlargement in the reader.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Retsomm
Retsomm merged commit 14b04f4 into main Jul 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant