Skip to content

Fix viewport-width decorations drawn under the notch in landscape - #870

Draft
mickael-menu wants to merge 1 commit into
developfrom
fix-issue-660
Draft

Fix viewport-width decorations drawn under the notch in landscape#870
mickael-menu wants to merge 1 commit into
developfrom
fix-issue-660

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

Fixes #660.

In reflowable EPUBs the web view spans the full screen width, so decorations using the viewport or page width were positioned from the physical screen edge, ending up under the notch or home indicator in landscape on notched iPhones.

The reflowable spread view now forwards the horizontal safe-area insets to the JavaScript layer through a new readium.setSafeAreaInsets API, and the decorator insets viewport- and page-width decorations accordingly — applying page insets only to the columns touching the viewport edges in multi-column spreads (RTL-aware). Decorations relayout automatically when the insets change on rotation, and inset updates are serialized so rapid rotation events can't apply stale values out of order. Vertical writing modes are intentionally unaffected (their full-span axis is already inset natively).

Needs on-device verification on a notched iPhone in landscape: .viewport-width decorations in paginated and scroll mode, .page-width decorations in two-column layout, and a regression check on standard wrap highlights.

🤖 Generated with Claude Code

Fixes #660.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mickael-menu
mickael-menu changed the base branch from swift6 to develop August 5, 2026 14:26
Comment on lines +129 to +132
sendSafeAreaInsetsTask = Task { [previousTask = sendSafeAreaInsetsTask] in
await previousTask?.value
_ = await evaluateScript(script)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should [weak self] be used in case the view is no longer there while the task is still executing?

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.

2 participants