PR: #341: [Story-1337] Add KB image zoom lightbox
by @ayush-pramaan
View PR →
Story 1337
KB image zoom lightbox
Knowledge Base images now use one shared zoom interaction from
HelpArticle, so both the full Help Center article page
and the contextual page-help drawer render the same enlarge control
and Dialog lightbox.
Shared render path
-
HelpArticledelegates image blocks toKbImageZoom. -
The old image-path
figcaptionis gone, socontent/kb/...source paths no longer display under article screenshots. -
KbImageZoomhas its own Storybook coverage for default, drawer-width, and tall-screenshot states.
Interaction
- The screenshot itself is a keyboard-accessible zoom trigger.
-
A visible top-right icon button reuses
Button,Tooltip, and the LucideMaximize2icon. -
The lightbox reuses
Dialog, renders at roughly96vw x 94vh, and keeps the imageobject-contain. - The Dialog closes through the close button, Escape key, and backdrop click.
Accessibility and localization
- The Dialog title comes from the article image alt text and is hidden visually.
-
The image-enlarge and lightbox-close controls use localized
HelpCenter.articlelabels in both English and Hindi. -
DialogContentnow supports an opt-incloseOnInteractOutsideprop. The default remains unchanged for existing Dialog callers.
Verification
pnpm typecheck-
pnpm lintpassed with only pre-existing add-matter warnings. pnpm testpnpm storybook:buildNEXT_PUBLIC_ENV=local pnpm buildgit diff --check- Built Storybook runtime checks covered full article, drawer, close-button, Escape, backdrop close, and narrow viewport sizing.
Files changed
7 file(s), +175 / -15 lines
| Path | Role | + | - |
|---|---|---|---|
| messages/en.json | Config | +2 | -0 |
| messages/hi.json | Config | +2 | -0 |
| src/components/kb/HelpArticle.tsx | Component | +3 | -9 |
| src/components/kb/HelpDrawer.tsx | Component | +4 | -3 |
| src/components/kb/KbImageZoom.stories.tsx | Component | +53 | -0 |
| src/components/kb/KbImageZoom.tsx | Component | +100 | -0 |
| src/components/ui/dialog.tsx | Component | +11 | -3 |