Enable automatic zooming images#4776
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📖 Docs PR preview links
|
…ge in <NoZoom></NoZoom>
# Conflicts: # src/components/elements/Images/NoZoom.tsx # src/components/elements/Images/ZoomableImage.module.css # src/components/elements/Images/ZoomableImage.tsx # src/components/images/ZoomingImage.js # src/components/index.js
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
vale
readme/ZOOMABLE_IMAGES.md|140 col 62| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/dotnet/best-practices/converters-and-encryption'.
readme/ZOOMABLE_IMAGES.md|144 col 40| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/client/temporal-client'.
readme/ZOOMABLE_IMAGES.md|145 col 37| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/nexus/feature-guide'.
readme/ZOOMABLE_IMAGES.md|146 col 47| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/data-handling/data-conversion'.
readme/ZOOMABLE_IMAGES.md|150 col 42| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/java/client/temporal-client'.
readme/ZOOMABLE_IMAGES.md|151 col 39| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/java/nexus/feature-guide'.
readme/ZOOMABLE_IMAGES.md|152 col 60| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/java/best-practices/converters-and-encryption'.
readme/ZOOMABLE_IMAGES.md|156 col 44| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/python/client/temporal-client'.
readme/ZOOMABLE_IMAGES.md|157 col 41| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/python/nexus/feature-guide'.
readme/ZOOMABLE_IMAGES.md|161 col 42| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/ruby/client/temporal-client'.
readme/ZOOMABLE_IMAGES.md|162 col 60| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/ruby/best-practices/converters-and-encryption'.
readme/ZOOMABLE_IMAGES.md|166 col 48| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/typescript/client/temporal-client'.
readme/ZOOMABLE_IMAGES.md|167 col 45| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/typescript/nexus/feature-guide'.
readme/ZOOMABLE_IMAGES.md|168 col 50| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/typescript/best-practices/debugging'.
readme/ZOOMABLE_IMAGES.md|172 col 23| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/nexus/operations'.
readme/ZOOMABLE_IMAGES.md|173 col 24| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/handling-messages'.
readme/ZOOMABLE_IMAGES.md|174 col 21| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/nexus/registry'.
readme/ZOOMABLE_IMAGES.md|175 col 21| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/nexus/security'.
readme/ZOOMABLE_IMAGES.md|176 col 26| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/activity-definition'.
readme/ZOOMABLE_IMAGES.md|177 col 17| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/task-queue'.
readme/ZOOMABLE_IMAGES.md|178 col 34| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/encyclopedia/retry-policies'.
readme/ZOOMABLE_IMAGES.md|182 col 19| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/cloud/limits'.
readme/ZOOMABLE_IMAGES.md|186 col 35| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/monitoring'.
readme/ZOOMABLE_IMAGES.md|187 col 54| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/server-frontend-api-reference'.
readme/ZOOMABLE_IMAGES.md|188 col 44| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/production-deployment/data-encryption'.
readme/ZOOMABLE_IMAGES.md|189 col 33| [Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/security'.
| @@ -0,0 +1,193 @@ | |||
| # Zoomable images (Stripe-style click-to-expand) | |||
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Temporal.Headings] 'Zoomable images (Stripe-style click-to-expand)' should use sentence-style capitalization.
|
|
||
| ## How to test | ||
|
|
||
| 1. `yarn start` and open a page with large images, e.g. [`/cloud/billing`](https://docs.temporal.io/cloud/billing) or [`/develop/go/client/temporal-client`](https://docs.temporal.io/develop/go/client/temporal-client). |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/cloud/billing'.
|
|
||
| ## How to test | ||
|
|
||
| 1. `yarn start` and open a page with large images, e.g. [`/cloud/billing`](https://docs.temporal.io/cloud/billing) or [`/develop/go/client/temporal-client`](https://docs.temporal.io/develop/go/client/temporal-client). |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/client/temporal-client'.
| 1. `yarn start` and open a page with large images, e.g. [`/cloud/billing`](https://docs.temporal.io/cloud/billing) or [`/develop/go/client/temporal-client`](https://docs.temporal.io/develop/go/client/temporal-client). | ||
| 2. Hover an oversized image → cursor becomes `zoom-in`. Click → full-width modal opens. Click the image / backdrop / `×`, or press `Escape` → it closes and the page scroll is restored. | ||
| 3. Open a page whose images already fit → confirm there is **no** zoom cursor and clicking does nothing. | ||
| 4. **Aspect ratio:** confirm images are not squished; compare against production ([docs.temporal.io](https://docs.temporal.io)). |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io'.
| 3. Open a page whose images already fit → confirm there is **no** zoom cursor and clicking does nothing. | ||
| 4. **Aspect ratio:** confirm images are not squished; compare against production ([docs.temporal.io](https://docs.temporal.io)). | ||
| 5. **Responsive:** narrow the browser window and reload — images that fit at full width become zoomable as the column shrinks. | ||
| 6. **Dark/light + captions:** open [`/codec-server`](https://docs.temporal.io/codec-server), toggle the navbar theme switch, and confirm the diagrams swap to their dark/light variants and the captions still render. Note the on-demand fetch described above on first toggle. |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/codec-server'.
| - [/cloud/export/aws-export-s3](https://docs.temporal.io/cloud/export/aws-export-s3) — _max 1981px_ | ||
| - [/cloud/nexus](https://docs.temporal.io/cloud/nexus) — _max 1714px_ | ||
| - [/cloud/terraform-provider](https://docs.temporal.io/cloud/terraform-provider) — _max 1478px_ | ||
| - [/cloud/migrate/automated](https://docs.temporal.io/cloud/migrate/automated) — _max 1202px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/cloud/migrate/automated'.
| - [/cloud/nexus](https://docs.temporal.io/cloud/nexus) — _max 1714px_ | ||
| - [/cloud/terraform-provider](https://docs.temporal.io/cloud/terraform-provider) — _max 1478px_ | ||
| - [/cloud/migrate/automated](https://docs.temporal.io/cloud/migrate/automated) — _max 1202px_ | ||
| - [/cloud/api-keys](https://docs.temporal.io/cloud/api-keys) — _max 822px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/cloud/api-keys'.
|
|
||
| #### Develop | ||
|
|
||
| - [/develop/worker-performance](https://docs.temporal.io/develop/worker-performance) — _max 2248px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/worker-performance'.
|
|
||
| #### Develop — dotnet | ||
|
|
||
| - [/develop/dotnet/client/temporal-client](https://docs.temporal.io/develop/dotnet/client/temporal-client) — _max 4096px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/dotnet/client/temporal-client'.
| #### Develop — dotnet | ||
|
|
||
| - [/develop/dotnet/client/temporal-client](https://docs.temporal.io/develop/dotnet/client/temporal-client) — _max 4096px_ | ||
| - [/develop/dotnet/nexus/feature-guide](https://docs.temporal.io/develop/dotnet/nexus/feature-guide) — _max 3542px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/dotnet/nexus/feature-guide'.
…size before decided to enable zoom... if, due to height for example, the image will not actually get bigger, then skip the zoom cursor/action
|
|
||
| - [/develop/dotnet/client/temporal-client](https://docs.temporal.io/develop/dotnet/client/temporal-client) — _max 4096px_ | ||
| - [/develop/dotnet/nexus/feature-guide](https://docs.temporal.io/develop/dotnet/nexus/feature-guide) — _max 3542px_ | ||
| - [/develop/dotnet/best-practices/converters-and-encryption](https://docs.temporal.io/develop/dotnet/best-practices/converters-and-encryption) — _max 1320px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/dotnet/best-practices/converters-and-encryption'.
|
|
||
| #### Develop — go | ||
|
|
||
| - [/develop/go/client/temporal-client](https://docs.temporal.io/develop/go/client/temporal-client) — _max 4096px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/client/temporal-client'.
| #### Develop — go | ||
|
|
||
| - [/develop/go/client/temporal-client](https://docs.temporal.io/develop/go/client/temporal-client) — _max 4096px_ | ||
| - [/develop/go/nexus/feature-guide](https://docs.temporal.io/develop/go/nexus/feature-guide) — _max 3542px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/nexus/feature-guide'.
|
|
||
| - [/develop/go/client/temporal-client](https://docs.temporal.io/develop/go/client/temporal-client) — _max 4096px_ | ||
| - [/develop/go/nexus/feature-guide](https://docs.temporal.io/develop/go/nexus/feature-guide) — _max 3542px_ | ||
| - [/develop/go/data-handling/data-conversion](https://docs.temporal.io/develop/go/data-handling/data-conversion) — _max 1320px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/go/data-handling/data-conversion'.
|
|
||
| #### Develop — java | ||
|
|
||
| - [/develop/java/client/temporal-client](https://docs.temporal.io/develop/java/client/temporal-client) — _max 4096px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/develop/java/client/temporal-client'.
|
|
||
| #### Evaluate | ||
|
|
||
| - [/cloud/limits](https://docs.temporal.io/cloud/limits) — _max 2752px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/cloud/limits'.
|
|
||
| #### Production deployment | ||
|
|
||
| - [/self-hosted-guide/monitoring](https://docs.temporal.io/self-hosted-guide/monitoring) — _max 2750px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/monitoring'.
| #### Production deployment | ||
|
|
||
| - [/self-hosted-guide/monitoring](https://docs.temporal.io/self-hosted-guide/monitoring) — _max 2750px_ | ||
| - [/self-hosted-guide/server-frontend-api-reference](https://docs.temporal.io/self-hosted-guide/server-frontend-api-reference) — _max 2148px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/server-frontend-api-reference'.
|
|
||
| - [/self-hosted-guide/monitoring](https://docs.temporal.io/self-hosted-guide/monitoring) — _max 2750px_ | ||
| - [/self-hosted-guide/server-frontend-api-reference](https://docs.temporal.io/self-hosted-guide/server-frontend-api-reference) — _max 2148px_ | ||
| - [/production-deployment/data-encryption](https://docs.temporal.io/production-deployment/data-encryption) — _max 2004px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/production-deployment/data-encryption'.
| - [/self-hosted-guide/monitoring](https://docs.temporal.io/self-hosted-guide/monitoring) — _max 2750px_ | ||
| - [/self-hosted-guide/server-frontend-api-reference](https://docs.temporal.io/self-hosted-guide/server-frontend-api-reference) — _max 2148px_ | ||
| - [/production-deployment/data-encryption](https://docs.temporal.io/production-deployment/data-encryption) — _max 2004px_ | ||
| - [/self-hosted-guide/security](https://docs.temporal.io/self-hosted-guide/security) — _max 1407px_ |
There was a problem hiding this comment.
[Temporal.RelativeLinks] Use a relative path instead of the absolute docs.temporal.io URL 'https://docs.temporal.io/self-hosted-guide/security'.
…to hopefully catch future issues
…le_flags for proper sync functionality.
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
There was a problem hiding this comment.
I think this could be actions/checkout@7 unless we need this specific version.
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Setup Node.js Environment | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
There was a problem hiding this comment.
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| uses: actions/setup-node@6 |
Zoomable images (Stripe-style click-to-expand)
Summary
Large images (and diagrams) in the docs are now click-to-expand, matching the behavior on
Stripe's docs:
zoom-incursor and clicking opens a full-width modal of the image at full resolution.zoom-out; clicking the image, clicking the backdrop, pressingEscape, or the×button closes it and restores the page.The effect is automatic for every image in the docs. Authors do not need to do anything; whether an image is zoomable is decided at runtime by comparing the image's natural pixel width to the width it is actually displayed at.
Opting out:
<NoZoom>Some images are decorative (e.g. the SDK banners on the
/developlanding pages) and should never expand, even though they are downscaled. Wrap them in<NoZoom>to disable the click-to-expand affordance:<NoZoom>is registered globally (src/theme/MDXComponents.tsx), so no import is needed in.mdxfiles. It is also exported fromsrc/componentsfor explicit use.ZoomableImagereads (useNoZoom()); when set, the overflow check never marks the image zoomable, so there is no zoom cursor and no modal.All SDK banners under
docs/develop/**are wrapped in<NoZoom>.What changed (I haven't updated these paths after @flippedcoder's component refactor)
src/components/images/ZoomableImage.tsx(new)src/components/images/ZoomableImage.module.css(new)height: autostyles.src/theme/MDXComponents.tsximgrenderer, so every Markdown image () flows throughZoomableImage; also registers<NoZoom>globally for opt-out.src/components/images/CaptionedImage.jsZoomableImagewhile keeping captions and dark/light support.src/components/images/ZoomingImage.js,EnlargeImage.jssrc/components/images/NoZoom.tsx(new)src/components/index.jsZoomableImageandNoZoom.How overflow is detected
On image load and whenever the column is resized (via a
ResizeObserver), the component comparesimg.naturalWidthto the renderedimg.clientWidth. The image is treated as zoomable only when it is being downscaled (naturalWidth > clientWidth). This is why the same image can be zoomable on a narrow laptop column (~630px) but not on a wide monitor (~1300px), and why high-resolution ("2x") screenshots — the bulk of our images — are zoomable.Aspect-ratio fix (important)
Docusaurus adds intrinsic
widthandheightattributes to Markdown images (to prevent layout shift). The stock theme image applies a class that forcesheight: auto, so the height scales with the width undermax-width: 100%.ZoomableImagenow applies the sameheight: autorule (.imagein its CSS module). Without it, images were rendered at their fitted width but full intrinsic height — visibly squished. If you ever see distorted images, this class is the first thing to check.Benefits
EnlargeImage(opened a raw image in a new tab),ZoomingImage, andCaptionedImage zoom="true"(inline toggles) now share one modal.role="dialog",aria-modal,Escapeto close, focusable close button, and body-scroll lock while open.Note: dark/light images now load on demand (performance trade-off)
CaptionedImagesupports asrcDarkvariant. The behavior changed:<img>were rendered into the DOM and swapped with CSS (visibility). Both files were downloaded up front, so toggling the site theme was instant.useColorMode, so only the current theme's image is downloaded.Trade-off: initial page load fetches one image instead of two (faster, less bandwidth). But if a reader switches the site theme while the page is open, the other variant has not been downloaded yet, so it is fetched on the spot — the swapped image may flash or appear blank for a moment on slow connections or for large files. The fetch is cached after the first switch. This only affects images that actually declare a
srcDark; plain Markdown images have a single source and are unaffected.How to test
yarn startand open a page with large images, e.g./cloud/billingor/develop/go/client/temporal-client.zoom-in. Click → full-width modal opens. Click the image / backdrop /×, or pressEscape→ it closes and the page scroll is restored./codec-server, toggle the navbar theme switch, and confirm the diagrams swap to their dark/light variants and the captions still render. Note the on-demand fetch described above on first toggle.Pages affected
Pages that previously had explicit zoom — now use the shared modal
These already offered some form of "enlarge". Their interaction is now the unified click-to-expand modal.
Newly zoomable pages (44)
Pages that did not previously have any zoom but contain raster images ≥ 800px wide, which now expand when downscaled. Grouped by area; the width shown is the page's largest image.
Best practices
Temporal Cloud
Develop
Develop — dotnet
Develop — go
Develop — java
Develop — python
Develop — ruby
Develop — typescript
Encyclopedia
Evaluate
Production deployment
The page lists above cover raster images (PNG/JPG/etc.), which are the large screenshots that motivated this change. SVG diagrams are vector and stay crisp at any size; they only trigger the zoom affordance if they declare an intrinsic width larger than the column, and expanding them adds little.