Skip to content

Update image handling - #14564

Merged
jaffrepaul merged 37 commits into
masterfrom
cursor/analyze-image-display-and-repository-architecture-6c32
Aug 11, 2025
Merged

Update image handling#14564
jaffrepaul merged 37 commits into
masterfrom
cursor/analyze-image-display-and-repository-architecture-6c32

Conversation

@jaffrepaul

Copy link
Copy Markdown
Contributor

DESCRIBE YOUR PR

This PR implements a modern image lightbox for all documentation images, enhancing the user experience.

Previously, clicking an image would open the raw image file in a new browser tab. This change introduces an in-page modal overlay for images, leveraging Radix UI Dialog for accessibility and a smooth user experience.

Key features:

  • Images now open in a responsive lightbox overlay on click.
  • Preserves existing functionality: right-click or Ctrl/Cmd+click still opens the image in a new tab.
  • Includes accessibility features (keyboard navigation, ARIA labels).
  • Adds subtle CSS animations for opening/closing the lightbox.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

  • [Sentry Doc

Co-authored-by: paul.jaffre <paul.jaffre@sentry.io>
@vercel

vercelBot commented Aug 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

NameStatusPreviewCommentsUpdated (UTC)
develop-docs✅ Ready (Inspect)Visit Preview💬 Add feedbackAug 9, 2025 2:07am
sentry-docs✅ Ready (Inspect)Visit Preview💬 Add feedbackAug 9, 2025 2:07am

@codecov

codecovBot commented Aug 5, 2025

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 91.16kB (0.4%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle nameSizeChange
sentry-docs-client-array-push9.9MB47.32kB (0.48%) ⬆️
sentry-docs-server-cjs12.4MB43.84kB (0.35%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset NameSize ChangeTotal SizeChange (%)
static/chunks/pages/_app-*.js-3 bytes882.71kB-0.0%
static/css/*.css192 bytes12.9kB1.51%
static/css/*.css-928 bytes961 bytes-49.13%
static/css/*.css-1 bytes1.89kB-0.05%
static/css/*.css1.3kB746.03kB0.17%
static/css/*.css-1.28kB12.71kB-9.12%
static/css/*.css6.51kB11.69kB125.92% ⚠️
static/css/*.css-14.26kB4.84kB-74.64%
static/css/*.css(New)11.0kB11.0kB100.0% 🚀
static/chunks/8321-*.js-3 bytes425.87kB-0.0%
static/chunks/8423-*.js(New)284.92kB284.92kB100.0% 🚀
static/chunks/2408-*.js5.33kB283.72kB1.92%
server/app/api/ip-*.js737 bytes263.38kB0.28%
server/app/_not-*.js737 bytes263.37kB0.28%
server/app/[[...path]]/page_client-*.js737 bytes263.33kB0.28%
server/app/platform-*.js796 bytes248.17kB0.32%
static/chunks/app/[[...path]]/page-*.js3.81kB87.96kB4.52%
static/chunks/app/platform-*.js5 bytes13.22kB0.04%
static/chunks/webpack-*.js10 bytes5.33kB0.19%
app-*.json82 bytes4.68kB1.78%
static/OUxI4c7JoJBvvHsK6For2/_buildManifest.js(New)684 bytes684 bytes100.0% 🚀
static/OUxI4c7JoJBvvHsK6For2/_ssgManifest.js(New)77 bytes77 bytes100.0% 🚀
static/chunks/2009-*.js(Deleted)-252.38kB0 bytes-100.0% 🗑️
static/W84V3ihBRYEI689c0Du_w/_buildManifest.js(Deleted)-684 bytes0 bytes-100.0% 🗑️
static/W84V3ihBRYEI689c0Du_w/_ssgManifest.js(Deleted)-77 bytes0 bytes-100.0% 🗑️

Files instatic/chunks/app/[[...path]]/page-*.js:

  • ./src/components/lightbox/lightbox.module.scss → Total Size: 387 bytes
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset NameSize ChangeTotal SizeChange (%)
1729.js5.66kB1.78MB0.32%
../instrumentation.js32 bytes1.1MB0.0%
9523.js32 bytes1.08MB0.0%
../app/[[...path]]/page.js.nft.json715 bytes739.39kB0.1%
../app/platform-redirect/page.js.nft.json715 bytes739.3kB0.1%
../app/sitemap.xml/route.js.nft.json715 bytes736.78kB0.1%
../app/[[...path]]/page.js35.95kB603.39kB6.34% ⚠️
2311.js(New)29.86kB29.86kB100.0% 🚀
9567.js24 bytes20.67kB0.12%
7269.js(Deleted)-29.86kB0 bytes-100.0% 🗑️

Files in../app/[[...path]]/page.js:

  • ./src/components/lightbox/lightbox.module.scss → Total Size: 378 bytes

  • ./src/components/imageLightbox/index.tsx → Total Size: 475 bytes

Files in2311.js:

  • ./app/globals.css → Total Size: 1 bytes

Files in9567.js:

  • ./src/remark-image-size.js → Total Size: 1.06kB

App Routes Affected:

App RouteSize ChangeTotal SizeChange (%)
/-1 bytes2.62MB-0.0%
/[[...path]]35.95kB3.16MB1.15%

@jaffrepauljaffrepaul changed the title Analyze image display and repository architectureUpdate image handlingAug 5, 2025
cursor[bot]

This comment was marked as outdated.

Comment threadsrc/components/docImageClient.tsx Outdated
cursor[bot]

This comment was marked as outdated.

Comment threadapp/globals.css Outdated
cursor[bot]

This comment was marked as outdated.

@sergicalsergical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 🤖 is almost there! 😅

Comment threadpackage.json Outdated
Comment on lines +172 to +200
{shouldUseNextImage && dimensions ? (
<Image
src={getImageUrl(src, imgPath)}
alt={alt}
width={dimensions.width}
height={dimensions.height}
className="max-h-[90vh] max-w-[90vw] object-contain"
style={{
width: 'auto',
height: 'auto',
}}
priority
{...imageCompatibleProps}
/>
) : (
/* eslint-disable-next-line @next/next/no-img-element */
<img
src={getImageUrl(src, imgPath)}
alt={alt}
loading="lazy"
decoding="async"
className="max-h-[90vh] max-w-[90vw] object-contain"
style={{
width: 'auto',
height: 'auto',
}}
{...props}
/>
)}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we pass a isInline boolean to renderImage and then add classNAme if not? otherwise it's very similar to the function above

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

};

return (
<Dialog.Root open={open} onOpenChange={setOpen}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still abstract Dialog or call it Lightbox as it's own reusable component similar to ShadCN https://ui.shadcn.com/docs/components/dialog to consume in here.

return (
<Dialog.Root open={open} onOpenChange={setOpen}>
{/* Custom trigger that handles modifier keys properly */}
<div

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried using Dialog.Trigger? I think that would eliminate the need for custom onClick / keydown handling and would do semantics / accessibility for us?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things were getting wonky with the intended behavior and needed some custom event handling but things have changed a bit since then. I'll see if we can't lean on this now

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Comment on lines +125 to +132
<div
onClick={handleModifierClick}
onKeyDown={handleModifierKeyDown}
onClick={handleClick}
onAuxClick={handleClick}
onKeyDown={handleKeyDown}
className="cursor-pointer border-none bg-transparent p-0 block w-full no-underline"
aria-label={`View image: ${alt}`}
role="button"
tabIndex={0}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think it needs this (apart from aira-label) because https://github.com/radix-ui/primitives/blob/main/packages/react/dialog/src/dialog.tsx#L105-L107 handles it

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice. Less code is the best code! I still need some of it for the modifier logic but can pull some off

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup and you can put all that on the <Dialog.Trigger /> directly and remove the asChild prop

jaffrepauland others added 3 commits August 8, 2025 21:18
cursor[bot]

This comment was marked as outdated.

@sergicalsergical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Comment on lines +130 to +140
<Lightbox.Root open={open} onOpenChange={setOpen} content={renderImage(false)}>
<Lightbox.Trigger
onClick={handleClick}
onAuxClick={handleClick}
onKeyDown={handleKeyDown}
className="cursor-pointer border-none bg-transparent p-0 block w-full no-underline"
aria-label={`View image: ${alt}`}
>
{renderImage()}
</Lightbox.Trigger>
</Lightbox.Root>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@jaffrepaul
jaffrepaul merged commit 7863d47 into masterAug 11, 2025
15 checks passed
@jaffrepaul
jaffrepaul deleted the cursor/analyze-image-display-and-repository-architecture-6c32 branch August 11, 2025 17:22
codyde added a commit that referenced this pull request Aug 13, 2025
* 'master' of https://github.com/getsentry/sentry-docs: (22 commits)
Fix incorrectly placed comma (#14592)
fix(devservices): Typo in devservices docs (#14636)
ref(ourlogs): Add log size limit (#14635)
Document undocumented php prefix option (#14634)
getsentry/relay@7958273
Unreal Engine: Update plugin docs (#14624)
feat: Update min js sdk version for logging and update console logging snippet (#14614)
feat: [Unreal] Add transaction and span set_data documentation (#14599)
feat(js): Add `ignoreSpans` documentation to Options page (#14572)
fix(js/browser): Amend user IP + `sendDefaultPii` change to v10 migration guide (#14609)
fix: Fix broken AI banner due to invalid syntax (#14627)
feat(partners)add-enablement-docs (#14095)
Fix image path issue & add test coverage for new lightbox (#14616)
feat(seer): update GHE setup to work with seer (#14617)
fix(replay): Document searchable properties `screen` and alias `screens` (#14603)
Update image handling (#14564)
Update using-hooks.mdx (#14605)
Godot: Document `disabled-in-editor-play` option (#14438)
fix(Docs) redirect and deprecate old metrics pages (#14602)
fix(relay): Update projects.mdx (#14606)
...
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Aug 27, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jaffrepaul@sergical@nikolovlazar@cursoragent