Skip to content

fix(reader): eliminate cover-mode page-turn flash - #1352

Merged
everpcpc merged 2 commits into
mainfrom
fix/reader-cover-turn-flash
Nov 28, 2026
Merged

everpcpc merged 2 commits into
mainfrom
fix/reader-cover-turn-flash

Conversation

@everpcpc

@everpcpc everpcpc commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Problem

In DIVINA Cover mode, tapping to turn the page visibly flashes in the area uncovered by the outgoing page: the revealed page looks like it was not loaded ahead of time and fades/pops in as the current page slides away.

Root cause

Three compounding issues in the cover deck (NativeCoverPageView on iOS/tvOS and macOS):

  1. Tap turns animated the revealed slot's alpha from 0 to 1. Idle neighbor slots were laid out with isHidden = true and alpha = 0, and updateSlotLayout() set alpha = 1 inside UIView.animate (and animator().alphaValue on macOS). As the front page slid off, the page underneath faded in from the background over the whole turn duration.
  2. Idle neighbor slots missed image-ready invalidations. applyPagePresentationInvalidation skipped isHidden slots, so when the next/previous page finished preloading while reading, the slot holding it never received the decoded image. It only pulled and prepared (rotate/border-crop/split) the image synchronously at the moment the turn began.
  3. Programmatic backward turns on iOS did not commit their offscreen start state before animating. Unhiding the previous-page slot, moving it offscreen, and starting .beginFromCurrentState in the same transaction could read a stale presentation position and flash the incoming page on top of the current one.

Fix

  • Match the EPUB cover deck (adoptNeighbor): keep idle neighbor slots composited underneath the opaque front slot (front zIndex 2, next 1, previous 0) instead of hiding them or setting alpha = 0.
  • Remove alpha/alphaValue mutations from slot layout entirely; only the moving slot's frame and shadow animate.
  • Deliver page-presentation invalidations to every configured deck slot (item != nil) regardless of isHidden, so preloaded images and translation overlays are already prepared while idle.
  • Make the coordinator the single owner of slot isHidden, and keep mouse/touch hit-testing and accessibility scoped to the active front slot (isUserInteractionEnabled + accessibilityElementsHidden on iOS/tvOS; NativeCoverSlotView.hitTest returning nil for inactive slots + setAccessibilityHidden on macOS, since AppKit hit-testing walks subviews and ignores layer.zPosition).
  • Stage non-animated slot state before starting programmatic turn animations, flushing the offscreen backward start position (CATransaction.flush()) on iOS before sliding in.
  • Remove the now-redundant isVisible flag from NativeCoverSlotView.Configuration and the unused setPlaybackActive helper, and record the cover-deck compositing invariant in the repo-conventions skill.

Validation

  • make format
  • make build — iOS, macOS, and tvOS all built successfully.
  • iOS Simulator (iPhone 18 Pro): switched DIVINA reader to Cover mode, recorded forward and backward tap turns, and inspected extracted frames — the next page is fully opaque from the first frame the current page moves, and backward turns slide in cleanly from offscreen with no first-frame overlap or fade. Confirmed via the accessibility tree that covered neighbor slots are not exposed while idle.
  • Parallel Standards + Spec code review pass; fixed the macOS hit-testing/accessibility gap surfaced by review.

@everpcpc
everpcpc merged commit 35068d8 into main Nov 28, 2026
3 checks passed
@everpcpc
everpcpc deleted the fix/reader-cover-turn-flash branch November 28, 2026 06:44
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