Skip to content

fix: let a tap reach the text on a paged document - #693

Merged
andiwand merged 1 commit into
mainfrom
fix/page-hit-testing
Aug 16, 2026
Merged

fix: let a tap reach the text on a paged document#693
andiwand merged 1 commit into
mainfrom
fix/page-hit-testing

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Stacked on #692 — both touch document.css and its reference copy. Base it on
main once that merges.

.odr-page-outer carried z-index:-1000, which paints the page and its whole
subtree behind its parent's in-flow content. It still looks right, because the
backdrop is the propagated canvas background rather than a box covering it —
but hit testing walks paint order backwards, so every tap on a document landed
on .odr-pages and never reached the text. No caret, and on ios no keyboard.
Android papered over the same rule by force-showing the soft keyboard when edit
mode starts.

What the rule was actually for is the stacking context: a shape's
background is a z-index:-1 child (translate_rect / translate_circle /
translate_line), which needs the page to be one or it escapes to the root
context and paints behind the canvas. A negative z-index makes a stacking
context, so it worked — but any of them does, and this one also takes the page
out of reach. isolation:isolate is the same context without the paint-order
move.

It came in with #648, ported verbatim from OpenDocument.js (9a7f522 "page zindex", May 2025), where it had no stated reason either.

Verification

  • elementFromPoint over a run: DIV.odr-pages before, X-S after — same
    page, only the rule flipped.
  • Rendering: odr_test run per side, every html file byte-identical and only
    resources/document.css differing, then compare-html --driver chrome over
    both — 334 public and 1225 private files all match.
  • CI's compare step covers output/ only, so this needs no reference update;
    the pins move anyway to keep resources/ in the reference tree honest.

@andiwand
andiwand force-pushed the feature/search-every-view branch from d7397cf to 0f1b1ee Compare August 16, 2026 07:41
@andiwand
andiwand force-pushed the fix/page-hit-testing branch from a0d86b2 to be0e6e4 Compare August 16, 2026 07:43
Base automatically changed from feature/search-every-view to main August 16, 2026 07:56
`.odr-page-outer` was `z-index:-1000`, which paints the page and everything in
it behind its parent's in-flow content. It looks right, because the backdrop is
the propagated canvas background rather than a box over it, but hit testing
walks paint order: every tap landed on `.odr-pages`, so no caret appeared and
ios never unfolded the keyboard.

What the rule was for is the stacking context, which scopes the `z-index:-1`
background of a shape to its page; the negative value itself was not. It is now
`isolation:isolate`. Rendering is unchanged - both corpora compare identical
under `compare-html`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0192ViykqXESAC9VM8Pv2R3u
@andiwand
andiwand force-pushed the fix/page-hit-testing branch from be0e6e4 to 76880c0 Compare August 16, 2026 07:57
@andiwand
andiwand merged commit ad21f1d into main Aug 16, 2026
27 checks passed
@andiwand
andiwand deleted the fix/page-hit-testing branch August 16, 2026 08:00
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