Repository navigation
fix(zoom)!: open nested items by keyboard, skip hidden ones, and load data-zoom-src behind the page image - #16
Conversation
|
This repo's model isn't fully set up yet. OpenAI-compatible model selected but required configuration is missing: OPENAI_COMPATIBLE_API_KEY. only the API key is sensitive — add it as a secret at https://github.com/onmax/comark-plugins/settings/secrets/actions. everything else is plain workflow OPENAI_COMPATIBLE_BASE_URL: https://your-endpoint.example.com/v1 set the last two to the real limits of the model your endpoint serves. Pullfrog can't for full setup instructions, see https://docs.pullfrog.com/openai-compatible
|
fb88bb4 to
7bf4263
Compare
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
There was a problem hiding this comment.
Important
The latest commit introduces a regression for nested zoom items whose author explicitly sets tabindex="0": the new settlement pass removes that tab stop as if it were renderer-generated. Please preserve the author's explicit zero before merging.
Reviewed changes
The incremental review covers the changes since fdaff9c: hardening the line-height probe, guarding late image loads, restoring scroll settings during shutdown, and settling focusability for dynamically added nested zoom items.
- Hardened the line-height probe — Isolated the measurement span from host CSS so page rules cannot change the zoom sizing decision.
- Guarded asynchronous image work — Prevented stale image loads from mutating a closed or replaced zoom view.
- Restored scroll state on shutdown — Added cleanup for
history.scrollRestorationwhen the runtime is stopped while a dialog is open. - Observed late-added items — Replaced the one-time readiness hook with a mutation observer that settles nested tab stops as content arrives.
gpt-5.6-sol | 𝕏
| // An item inside another one zooms with it, so only the outer one is a tab stop. Renderers can't know: a slide and | ||
| // the screenshot inside it come from different plugins. Any other tabindex is the author's and stays. | ||
| function settle() { | ||
| for (const node of document.querySelectorAll<HTMLElement>(`${SELECTOR}[tabindex="0"]`)) |
There was a problem hiding this comment.
This removes an explicit author tabindex="0" from any nested [data-zoom] item, because the DOM contains no marker distinguishing that value from a renderer-added zero. As a result, an author who intentionally keeps a nested item in the tab order loses that behavior, despite the comment and test claiming author tabindex values are preserved.
Technical details
# Preserve explicit nested tabindex values
## Affected sites
- `packages/zoom/src/script.ts:101-102` — `settle()` removes every nested zoom item whose current attribute is `"0"`.
- `packages/zoom/src/index.ts:36` — `attrs.tabindex ??= "0"` collapses generated and author-provided zero values into the same output attribute.
- `packages/zoom/src/html.ts:27`, `packages/zoom/src/react.ts:29`, `packages/zoom/src/vue.ts:25`, `packages/zoom/src/svelte/Zoom.svelte:21` — renderers also emit generated `tabindex="0"` without provenance.
## Required outcome
- Nested items generated without an author tabindex should stop being tab stops.
- An author-provided `tabindex="0"` must remain intact, including for dynamically inserted markup.
- The implementation must retain enough provenance or use another explicit contract so these cases are distinguishable at settlement time.
## Suggested approach
- Mark generated tab stops separately, or otherwise preserve author tabindex provenance through parse/render and dynamic DOM insertion, then settle only generated nested values.There was a problem hiding this comment.
Important
This commit can still leave history.scrollRestoration stuck at "manual" when shutdown races with a page-initiated close.
Reviewed changes
This incremental review covers the changes since the prior Pullfrog review: shutdown now closes without traversing history, overlapping close/open handling keeps scroll locking active, and the nested-item settlement observer is retained for inserted nodes.
- Separated shutdown from history navigation —
stop()now closes the active view without invokinghistory.back()or relying on a latepopstatelistener. - Handled overlapping views — A zoom opened from a close event keeps scroll restoration manual until the replacement view closes.
- Scoped mutation settlement — Newly added subtrees are settled rather than rescanning the whole document.
gpt-5.6-sol | 𝕏
| added.disconnect(); | ||
| listeners.abort(); | ||
| style?.remove(); | ||
| void shut("stop"); |
There was a problem hiding this comment.
stop() can race with a page-initiated close: shut("page") has already set current.closing and is waiting for the popstate/animation, then shutdown aborts the listener and calls shut("stop"), which returns immediately at line 468. That leaves the pending restoration value untouched and history.scrollRestoration stuck at "manual" after the runtime has stopped.
Technical details
# Restore scroll state when shutdown interrupts a close
## Affected sites
- `packages/zoom/src/script.ts:466-471` — the `current.closing` early return prevents the shutdown path from restoring a pending scroll setting.
- `packages/zoom/src/script.ts:588-594` — shutdown aborts the `popstate` listener before invoking `shut("stop")`, so the pending restoration callback cannot run.
## Required outcome
- Stopping the runtime during an in-flight page close must restore the page's original `history.scrollRestoration` setting and must not leave a late history traversal able to mutate the stopped runtime.
## Suggested approach
- Ensure shutdown resolves or cancels any pending restoration before or despite the closing guard, and define how the already-requested history traversal is handled after listeners are removed.163951f to
212fe25
Compare
Latest result Pull request merged. Final answersSession Pull request merged. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. Session Pass interrupted; current webhook state retained. |
… data-zoom-src behind the page image
- Enter on an item inside another one (a screenshot in a carousel slide) opens the outer one, like a click.
Nested items lose their tabindex when the script starts, so each slide is one tab stop.
- A group leaves out items with no size, such as those in a closed tab or a closed <details>.
- data-zoom-src: the copy keeps the page's image until the larger file has loaded, then drops srcset,
sizes, and a picture's sources so the larger file wins.
- The strip's thumbnails keep the page's images and their loading attribute.
- The copy is placed again whenever one of its images loads, and is sized by its own height.
- An image without data-zoom-src zooms no larger than its natural size.
- An element marked `{data-zoom}` by hand zooms with `images: false` too, and gets tabindex="0".
- `{zoom=false}` on an image, or `data-zoom=false`, keeps it from zooming.
- `::zoom` keeps its id and class in every renderer and drops other attributes; Vue no longer passes
them all through.
- The events are declared on GlobalEventHandlersEventMap, so document and window listeners type-check.
- The thumbnail strip is role="group" instead of a tablist.
- `start()` from comark-zoom/client adds the bundled styles when called with no argument. The
self-contained function the HTML renderer inlines moved to src/script.ts.
- svelte/index.d.ts exports ZoomDetail, and the Svelte Zoom takes id and class.
BREAKING CHANGE: the --cz-backdrop, --cz-ink, --cz-muted, --cz-line, --cz-hover, and --cz-active
variables are gone. To theme only the zoomed view, set the --comark-* tokens on .cz-dialog.
BREAKING CHANGE: the thumbnail strip has role="group", not role="tablist".
BREAKING CHANGE: Vue's ::zoom no longer falls through attributes other than id and class.
…abindex, and port #11's probe and scroll fixes - A MutationObserver, disconnected by stop(), takes the tab stop off items nested in another one as they appear, so apps that render after mount and client-side navigation get one stop per item. Only tabindex="0" goes; any other value is the author's. - A large image that finishes loading after the view closed or moved on changes nothing. - Port c69e187: the line-height probe uses important inline styles, and scroll restoration goes back however the zoom closes, including stop() while it's open.
…keeps scroll restoration off, and settle only added nodes - Port 252e0d0: shut() takes where the close came from, and stop() never goes back in history, so a late popstate can't close a zoom opened after it. A zoom that opens before the last close has put scroll restoration back does it first. - The observer looks only at added elements and their zoomable descendants, not the whole document on every mutation. The startup pass still covers the document. - A comment says why a nested item's tabindex="0" goes even when the author set it.
f44e930 to
062e66a
Compare
commit: |
commit: |
… too (#25) #14 was squashed from a branch older than #16, so it added data-zoom-aside, copyOf, and originalOf to a copy of the zoom script in client.ts, while the HTML renderer kept inlining script.ts without them. Pages rendered to HTML got no aside and no mapping, and start() lost #16's fixes: keyboard opening of nested items, hidden items left out of a group, and data-zoom-src loading behind the page image. script.ts has the aside and the mapping again, on top of #16, and client.ts is the wrapper around it it was before. An e2e test checks both on a page from the HTML renderer.

Fixes from an audit of comark-zoom, plus the theming cleanup agreed for 0.2. Stacked on #13.
Breaking
--cz-*variables are gone (--cz-backdrop,--cz-ink,--cz-muted,--cz-line,--cz-hover,--cz-active).--cz-activeeven stood for two different tokens. To theme only the zoomed view, set the shared--comark-*tokens on.cz-dialog; a new e2e test checks that this themes the zoom and leaves the page alone.role="group"; it was atablistwith no tabs.::zoompassesidandclassthrough in every renderer and drops other attributes. Before, Vue passed everything and the others nothing.data-zoom=false, or{zoom=false}on an image, opts an element out. Before, it still zoomed on click.Fixes
<details>are left out of a group. They used to open 1px wide at 4×. The docs page hit this itself.data-zoom-src:srcsetand<picture>sources that would win over it. Before, it animated an empty box.{data-zoom}by hand gets the script and a tabindex, sozoom({ images: false })plus one marked image works.GlobalEventHandlersEventMap, sodocument.addEventListener("comark-zoom:open", …)type-checks as the docs show. A type test covers it.comark-zoom/svelteexportsZoomDetail.start()without an argument:start()fromcomark-zoom/clientnow adds the bundled styles; before, calling it without the CSS gave unstyled output. The self-contained function the HTML renderer inlines moved tosrc/script.ts(AGENTS.md is updated).New e2e tests cover each browser fix and fail against the old build.
pnpm readypasses, and so do all 28 e2e tests on the full stack.🤖 Generated with Claude Code