Skip to content

Stop the phone drawing its own links over a document - #191

Merged
andiwand merged 2 commits into
mainfrom
stop-the-phone-drawing-its-own-links
Sep 6, 2026
Merged

Stop the phone drawing its own links over a document#191
andiwand merged 2 commits into
mainfrom
stop-the-phone-drawing-its-own-links

Conversation

@andiwand

@andiwand andiwand commented Sep 6, 2026

Copy link
Copy Markdown
Member

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 WKWebViewConfiguration decoded from a storyboard arrives with all seven data detectors on rather than the API default of none — I logged 127 at 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.configuration returns a copy, so the only place a configuration can be set is before super.init. Hence the subclass. Nothing about layout moves: DocumentViewController already 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 dataDetectorTypes after init does nothing, and neither does a user-defined runtime attribute on the storyboard's configuration. A format-detection meta tag injected into the page did work, but it can only name four of the seven detector types.

The storyboard keeps its now-inert wkWebViewConfiguration element because Interface Builder fails to compile the file without one.

Checks

Driven in a simulator against the invoice, counting pixels rather than eyeballing:

  • Before: the artefact sits at y 751-760, x 498-596, alongside the PDF's genuine "Online bezahlen" link at y 873-890, x 82-212.
  • After: the artefact is gone and the genuine link is untouched.

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

Unreleased had 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

andiwand and others added 2 commits September 6, 2026 15:24
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
@andiwand
andiwand enabled auto-merge (squash) September 6, 2026 13:57
@andiwand
andiwand merged commit c16df6c into main Sep 6, 2026
4 checks passed
@andiwand
andiwand deleted the stop-the-phone-drawing-its-own-links branch September 6, 2026 14:08
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