Skip to content

fix(components): resolve gallery preview URLs against the site root - #484

Merged
schloerke merged 1 commit into
mainfrom
schloerke/fix-gallery-hover-gifs
Sep 24, 2026
Merged

schloerke merged 1 commit into
mainfrom
schloerke/fix-gallery-hover-gifs

Conversation

@schloerke

Copy link
Copy Markdown
Contributor

Hover GIFs on https://shiny.posit.co/py/components/ never played.

Quarto rewrites an <img>'s src to a relative path, but leaves data-* attributes site-root absolute. data-animated-src="/components/…/preview.gif" was fetched from shiny.posit.co/components/… (404, missing /py). The script's catch fell back to the thumbnail silently. The same bug also set the thumbnail back to a broken URL on pointerleave.

Fix: resolve both data-* paths against Quarto's <meta name="quarto:offset">, so it works under /py in prod and at the root on Netlify previews.

Verified against prod with the patched script injected: GIF request → /py/components/inputs/action-button/preview.gif 200, card plays, poster restores on leave.

Quarto rewrites an img's src to a relative path but leaves data-* attributes
site-root absolute, so the hover GIF was fetched from /components/... instead
of /py/components/... in production (404) and the poster broke on pointerleave.
@schloerke
schloerke merged commit 5b97d8b into main Sep 24, 2026
31 checks passed
@schloerke
schloerke deleted the schloerke/fix-gallery-hover-gifs branch September 24, 2026 18:26

This branch was successfully deployed

1 active deployment
pr-484 — b1743799 Deployed Sep 24, 2026 by github-actions[bot]
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