Conversation
The new Compose Web navigators have no way to reach the WebView they render into, so an app cannot build on top of them the way it can on the legacy navigator. `docs/guides/navigator/epub-feature-parity.md` records this as "Custom JavaScript interfaces: legacy yes, new no, `registerJavascriptInterface` has no equivalent". Add `ReflowableWebConfiguration.javascriptInterfaces`, mirroring `EpubNavigatorFragment.Configuration.registerJavascriptInterface` including its `null`-to-skip-this-resource semantics, but keyed by `Url` since the new navigators do not use `Link`. The interfaces are registered where the navigator already attaches its own JS APIs to the resource web view. Refs readium#830 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
aiviapp
force-pushed
the
javascript-interfaces-web-navigator
branch
from
September 3, 2026 06:53
f50d12c to
f4c9ce2
Compare
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.
Closes part of #830.
Problem
The new Compose Web navigators give an app no way to reach the
WebViewthey render into, so features built on top of the legacy navigator have no path forward.docs/guides/navigator/epub-feature-parity.mdalready records it:Change
Adds
ReflowableWebConfiguration.javascriptInterfaces:It mirrors
EpubNavigatorFragment.Configuration.registerJavascriptInterface, including thenull-to-skip-this-resource semantics, but is keyed byUrlrather thanLinksince the new navigators do not useLink. The interfaces are registered inReflowableResource, in the sameLaunchedEffectwhere the navigator already attachesGesturesApi,DocumentStateApiandSelectionListenerApito the resource web view.JavascriptInterfaceFactorylives inreadium-navigator-web-commonso the fixed-layout navigator can adopt the same field later.Notes
FixedWebConfigurationstill has no equivalent. Happy to extend this PR to the fixed-layout navigator if you would rather land both together../gradlew :readium:navigators:web:readium-navigator-web-reflowable:compileDebugKotlinand./gradlew ktlintCheck.Why this matters to us
We maintain a Flutter wrapper around the toolkit for a reading app whose text-to-speech is generated outside Readium. On the legacy navigator we use
registerJavascriptInterfacefor a bridge that reports image taps and narration sync back from injected JS. The new reflowable navigator is attractive to us for continuous scrolling across resources, which the legacy one cannot do — but without an extension point on the web view, migrating would mean dropping features we ship today. #830 lists the other three gaps we hit; this is the one small enough to send as a patch.🤖 Generated with Claude Code