fix(ios): seed MO-active when a reader view registers - #230
Merged
Merged
Conversation
`audioEnable` turns on media-overlay column-break prevention through `currentReaderView?.setMOActive(true)`. The call is optional-chained, so when no reader view is mounted yet the flag is simply dropped. A view that registers afterwards starts with `isMOActive == false` and its per-resource `injectColumnBreakCSS()` check never fires, so highlighted text can be split across CSS columns for the rest of the session. Seed the flag from the live navigator in `registerAsCurrentReaderView`. Android has no equivalent gap: there the flag lives on the singleton `ReadiumReader`, not on the widget, so a widget mounting later already sees it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
Necessary fix to get out, I take full responsibility and merge this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
audioEnableenables media-overlay column-break prevention with:The call is optional-chained, so when no reader view is mounted at that moment the flag is silently dropped. A view that registers afterwards starts with
isMOActive == false, and its per-resource check innavigator(_:locationDidChange:):never fires —
shouldPreventColumnBreaksisisMOActive && preferences.preventMOColumnBreaks. So highlighted text can be split across CSS columns for the rest of the session.Android has no equivalent gap: the flag lives on the singleton
ReadiumReader, not on the widget, so a widget mounting later already sees it and re-injects on page change.Changes
FlutterReadiumPlugin.registerAsCurrentReaderViewseeds the incoming view's MO-active state from the live navigator (timebasedNavigator is FlutterMediaOverlayNavigator).Verification
bin/format— clean.bin/analyze— no issues in either package.flutter build ios --no-codesigninflutter_readium/example— succeeded (Built build/ios/iphoneos/Runner.app), which is the gateflutter_readium/ios/CLAUDE.mdrequires for Swift changes.Not verified: no runtime check of the highlighting itself. Reproducing the original symptom needs a guided-navigation or media-overlay book whose reader view mounts after
audioEnable, which the current app flow does not normally produce — the deferral in the consuming app exists precisely to avoid that ordering. Android is untouched.Context
Found while fixing Notalib/LYT4#1467. That app defers
audioEnablefor guided-navigation books until the reader reports ready, and the only thing that deferral buys is this ordering. With this fix the deferral becomes unnecessary and can be removed app-side.🤖 Generated with Claude Code