Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/fix-mermaid-aria-hidden.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'streamdown': patch
---

fix(mermaid): add aria-hidden to decorative SVG icons in mermaid toolbar buttons

Mermaid toolbar buttons (download, fullscreen, pan/zoom controls) already have
accessible titles/labels, but the inline SVG icons were exposed to the accessibility
tree causing "Content with images must be labeled" warnings. Added aria-hidden={true}
to all decorative icon elements in download-button, fullscreen-button, and pan-zoom
components.

Fixes #485
2 changes: 1 addition & 1 deletion packages/streamdown/lib/mermaid/download-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const MermaidDownloadDropdown = ({
title={t.downloadDiagram}
type="button"
>
{children ?? <icons.DownloadIcon size={14} />}
{children ?? <icons.DownloadIcon aria-hidden={true} size={14} />}
</button>
{isOpen ? (
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/streamdown/lib/mermaid/fullscreen-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const MermaidFullscreenButton = ({
type="button"
{...props}
>
<Maximize2Icon size={14} />
<Maximize2Icon aria-hidden={true} size={14} />
</button>

{isFullscreen
Expand All @@ -115,7 +115,7 @@ export const MermaidFullscreenButton = ({
title={t.exitFullscreen}
type="button"
>
<XIcon size={20} />
<XIcon aria-hidden={true} size={20} />
</button>
{/* biome-ignore lint/a11y/noStaticElementInteractions: "div with role=presentation is used for event propagation control" */}
<div
Expand Down
6 changes: 3 additions & 3 deletions packages/streamdown/lib/mermaid/pan-zoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const PanZoom = ({
title="Zoom in"
type="button"
>
<ZoomInIcon size={16} />
<ZoomInIcon aria-hidden={true} size={16} />
</button>
<button
className={cn(
Expand All @@ -186,7 +186,7 @@ export const PanZoom = ({
title="Zoom out"
type="button"
>
<ZoomOutIcon size={16} />
<ZoomOutIcon aria-hidden={true} size={16} />
</button>
<button
className={cn(
Expand All @@ -196,7 +196,7 @@ export const PanZoom = ({
title="Reset zoom and pan"
type="button"
>
<RotateCcwIcon size={16} />
<RotateCcwIcon aria-hidden={true} size={16} />
</button>
</div>
) : null}
Expand Down
Loading