External links in markdown open in same tab instead of new tab #8371

Open
opened 2026-02-16 18:09:47 -05:00 by yindo · 1 comment
Owner

Originally created by @bercknash on GitHub (Feb 2, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Description

External links (http/https) in AI responses open in the same tab instead of a new tab when using opencode web.

Expected behavior

Clicking an external link in an AI response should open it in a new tab (target="_blank").

Actual behavior

Links open in the same tab, navigating away from OpenCode.

Root cause

The marked renderer correctly adds target="_blank" and rel="noopener noreferrer" to links, but DOMPurify strips these attributes during sanitization because they're not in the default allowed list.

Environment

  • OpenCode version: 1.1.48
  • Interface: opencode web
Originally created by @bercknash on GitHub (Feb 2, 2026). Originally assigned to: @adamdotdevin on GitHub. ## Description External links (http/https) in AI responses open in the same tab instead of a new tab when using `opencode web`. ## Expected behavior Clicking an external link in an AI response should open it in a new tab (`target="_blank"`). ## Actual behavior Links open in the same tab, navigating away from OpenCode. ## Root cause The `marked` renderer correctly adds `target="_blank"` and `rel="noopener noreferrer"` to links, but DOMPurify strips these attributes during sanitization because they're not in the default allowed list. ## Environment - OpenCode version: 1.1.48 - Interface: `opencode web`
yindo added the web label 2026-02-16 18:09:47 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10901: Desktop: Clicking external links in AI responses replaces OpenCode UI with chromeless webview
  • #10309: Desktop: Option to open links in external browser

These issues describe similar problems with external links not opening in new tabs/windows. While #10901 and #10309 are desktop-specific and this issue is about the web interface, they share the same root cause: external links not behaving as expected. The solutions may be related.

Feel free to ignore if your specific case differs from these issues.

@github-actions[bot] commented on GitHub (Feb 2, 2026): This issue might be a duplicate of existing issues. Please check: - #10901: Desktop: Clicking external links in AI responses replaces OpenCode UI with chromeless webview - #10309: Desktop: Option to open links in external browser These issues describe similar problems with external links not opening in new tabs/windows. While #10901 and #10309 are desktop-specific and this issue is about the web interface, they share the same root cause: external links not behaving as expected. The solutions may be related. Feel free to ignore if your specific case differs from these issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8371