Skip to content

fix(mcp): handle links inside SVG in the document bridge - #103

Open
asasemahmed wants to merge 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/mcp-svg-link-clicks
Open

asasemahmed wants to merge 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/mcp-svg-link-clicks

Conversation

@asasemahmed

Copy link
Copy Markdown

The click handler in the assemble_document bridge calls a.href.startsWith(...). On an SVG <a>, href is an SVGAnimatedString, not a string. So clicking a link inside a generated SVG diagram:

  • throws a.href.startsWith is not a function,
  • posts no open-link message,
  • skips preventDefault(), so the iframe navigates itself to the target.

The handler now reads href.baseVal, resolved against document.baseURI, when href is not a string. HTML links behave as before.

Tests: tests/renderer.test.ts runs the bridge script against small stubs and checks that both an HTML anchor and an SVG anchor post open-link and prevent the default navigation.

This branch has not been deployed

No deployments
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.

1 participant