Stop the phone drawing its own links over a document - #191
Merged
Conversation
A web view built from the storyboard comes with every kind of link detection on, and it cannot be turned off afterwards - so the view is built in code. The reader lays an invisible copy of a pdf's text over the page for selection and search. iOS found an address in that copy and made a link of it, and the link's colour brought the hidden text into view, on top of the page. Phone numbers and addresses in a document are no longer tappable. Links a pdf carries itself still are. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2KRXwg8FNE1vYXstnkh8e
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2KRXwg8FNE1vYXstnkh8e
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.
A PDF invoice showed its recipient's email address twice, the second copy blue and struck through. The engine was cleared of it: the same file renders correctly from odrcore's own HTML everywhere else.
iOS was drawing that. A
WKWebViewConfigurationdecoded from a storyboard arrives with all seven data detectors on rather than the API default of none — I logged127at runtime. The reader lays an invisible copy of a PDF's text over the page so it can be selected and searched, iOS finds an address in that copy and wraps it in a link, and the link's own colour paints the hidden text on top of the page.WKWebView.configurationreturns a copy, so the only place a configuration can be set is beforesuper.init. Hence the subclass. Nothing about layout moves:DocumentViewControlleralready sizes and positions the view in code, so the geometry the subclass skips decoding was never used.Two other routes were tried and rejected: assigning
dataDetectorTypesafter init does nothing, and neither does a user-defined runtime attribute on the storyboard's configuration. Aformat-detectionmeta tag injected into the page did work, but it can only name four of the seven detector types.The storyboard keeps its now-inert
wkWebViewConfigurationelement because Interface Builder fails to compile the file without one.Checks
Driven in a simulator against the invoice, counting pixels rather than eyeballing:
y 751-760, x 498-596, alongside the PDF's genuine "Online bezahlen" link aty 873-890, x 82-212.Also opened the ODT, ODS and DOCX samples plus the document browser with search running, and built and launched the Lite target to confirm the custom class resolves in both.
Note
Unreleasedhad no heading and its compare link still pointed at v1.43, so this adds the heading and moves the link to v1.44.Left open: on the same screenshot the table header row renders about 2.7x too large. This does not fix that, and I could not reproduce it on any simulator.
🤖 Generated with Claude Code