Skip to content

fix(web): wrap disabled IconButtons in span for MUI Tooltip - #348

Merged
arozumenko merged 2 commits into
mainfrom
fix/mermaid-tooltip-disabled
May 22, 2026
Merged

fix(web): wrap disabled IconButtons in span for MUI Tooltip#348
arozumenko merged 2 commits into
mainfrom
fix/mermaid-tooltip-disabled

Conversation

@arozumenko

Copy link
Copy Markdown
Owner

Summary

MUI Tooltip cannot listen to events on a disabled button — the browser stops all events on disabled elements. Wrapping with a <span> lets the Tooltip attach its listeners to the span instead.

Affected buttons:

  • Inline pill: zoom-out (at min scale), zoom-in (at max scale), reset-zoom (at scale=1)
  • Modal control pad: zoom-in (at max scale), zoom-out (at min scale)

Test plan

  • Zoom a diagram to minimum — zoom-out button shows disabled; hovering still shows tooltip "Zoom out"
  • Zoom to maximum — zoom-in button shows disabled; tooltip still appears
  • No MUI console warning about disabled button child

🤖 Generated with Claude Code

…lity

MUI Tooltip cannot listen to events on a disabled button element.
Wrap all disabled IconButtons in a <span> so Tooltip can attach its
event listeners to the span instead.

Affects: inline zoom-out, zoom-in, reset-zoom; modal zoom-in, zoom-out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Mermaid diagram zoom controls so MUI Tooltip continues to work even when the associated IconButton is disabled (by wrapping disabled tooltip children in a <span> to allow event listeners to attach).

Changes:

  • Wrapped inline pill zoom-out / zoom-in / reset-zoom IconButtons in a <span> inside Tooltip.
  • Wrapped fullscreen modal control-pad zoom-in / zoom-out IconButtons in a <span> inside Tooltip.

Comment on lines 224 to 228
transition: 'opacity 200ms ease',
pointerEvents: hovered ? 'auto' : 'none',
}}
>
<Tooltip title="Zoom out" placement="bottom">
Comment on lines +238 to 242
</IconButton>
</span>
</Tooltip>

<Tooltip title="Zoom in" placement="bottom">
Comment on lines 263 to +268
<FullscreenIcon fontSize="small" />
</IconButton>
</Tooltip>

<Tooltip title="Reset zoom" placement="bottom">
<IconButton
size="small"
aria-label="Reset zoom"
onClick={(e) => { e.stopPropagation(); setScale(1); }}
sx={{ color: pillColor, p: 0.5 }}
disabled={scale === 1}
>
<FitScreenIcon fontSize="small" />
</IconButton>
<span>
@arozumenko
arozumenko merged commit 695bd5c into main May 22, 2026
4 of 5 checks passed
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.

2 participants