Skip to content

adk web: Links in chat responses should open in a new tab #4580

Open
google/adk-web
#541

Description

@Vidon212

Description

When the agent responds with a URL in adk web, clicking it navigates away
from the chat — the user loses their conversation. Links rendered in chat
messages should open in a new browser tab.

Steps to reproduce

  1. adk web --reload_agents
  2. Ask the agent a question that produces a response containing a URL
  3. Click the link in the rendered chat message
  4. The browser navigates away from the ADK web UI — the conversation is lost

Expected behavior

External links (http://… / https://…) in chat responses should open in a
new tab (target="_blank") with rel="noopener noreferrer".

Suggested fix

In the Angular web UI component that renders chat messages, add
target="_blank" and rel="noopener noreferrer" to auto-linked URLs.

For example, if links are rendered via Angular's markdown/HTML binding, a
directive or pipe could post-process <a> elements:

// Wherever chat message HTML is rendered:
// Add target="_blank" rel="noopener noreferrer" to external <a> tags

Workaround

We're currently injecting a MutationObserver script into
google/adk/cli/browser/index.html post-install that patches links as they
appear in the DOM. This works but has to be re-applied after every
pip install.

Environment

- adk-python version: latest (pip)
- Browser: Chrome / Safari / Firefox (all affected)
- OS: macOS / Linux

Activity

  1. added
    web[Component] This issue will be transferred to adk-web
    on Feb 22, 2026
  2. added theissue type on Feb 22, 2026
  3. Sravan1011 commented on Feb 22, 2026

    @Sravan1011

    @Vidon212 Sir can you assign this task to me

  4. surajksharma07 commented on Feb 22, 2026

    @surajksharma07
    Collaborator

    @Vidon212 The root cause is in the marked.js link() renderer bundled at google/adk/cli/browser/main-*.js — it builds <a href="URL"> with no target or rel, so every click navigates in the same tab.

    Until this lands in adk-web, patch the installed bundle by finding the string let o='<a href="'+t+'"' in that file and replacing it with let o='<a href="'+t+'" target="_blank" rel="noopener noreferrer"' — a backup copy first is recommended since you'll need to redo this after upgrades.

    The proper fix belongs in the adk-web Angular markdown component.

  5. Sravan1011 commented on Feb 23, 2026

    @Sravan1011

    @Vidon212 The root cause is in the marked.js link() renderer bundled at google/adk/cli/browser/main-*.js — it builds <a href="URL"> with no target or rel, so every click navigates in the same tab.

    Until this lands in adk-web, patch the installed bundle by finding the string let o='<a href="'+t+'"' in that file and replacing it with let o='<a href="'+t+'" target="_blank" rel="noopener noreferrer"' — a backup copy first is recommended since you'll need to redo this after upgrades.

    The proper fix belongs in the adk-web Angular markdown component.

    so this is issue is solved, have you fixed the angular componenet?

  6. surajksharma07 commented on Feb 23, 2026

    @surajksharma07
    Collaborator

    @Sravan1011 The Angular component hasn't been updated yet — the bundle patch is the working workaround for now and it does resolve the UX problem.

  7. surajksharma07 commented on Feb 23, 2026

    @surajksharma07
    Collaborator

    @seanzhou1023 Please have a look into it.

  8. Sravan1011 commented on Feb 23, 2026

    @Sravan1011

    @Sravan1011 The Angular component hasn't been updated yet — the bundle patch is the working workaround for now and it does resolve the UX problem.

    So shall we take up the angular problem or the maintainers are going to work on that patch ?

  9. surajksharma07 commented on Feb 23, 2026

    @surajksharma07
    Collaborator

    @Sravan1011 If you want to contribute the fix, feel free to open a PR.

  10. Sravan1011 commented on Feb 23, 2026

    @Sravan1011

    hey have you submitted any pr ? if not can you assign me the issue

  11. surajksharma07 commented on Feb 25, 2026

    @surajksharma07
    Collaborator

    @wyf7107 PTAL.

  12. surajksharma07 commented on Feb 25, 2026

    @surajksharma07
    Collaborator

    @Sravan1011 No PR has been submitted yet.

    The actual fix (adding target="_blank" rel="noopener noreferrer" to the link renderer) needs to go into the adk-web
    repository's Angular markdown component — not adk-python.

    Feel free to open a PR ; the bundle workaround I described confirms exactly where the change needs to happen.

    Team is looking more into it.

  13. removed their assignment
    on Feb 26, 2026
  14. Vidon212 commented on Oct 4, 2026

    @Vidon212
    Author

    I’ve opened a fix in the adk-web Angular Markdown component: google/adk-web#541
    HTTP/HTTPS links now open in a new tab with rel="noopener noreferrer", including links added during streaming. Relative, fragment, and email links retain their existing behavior.
    Added regression tests; locally, 781 tests pass and the production build succeeds. The PR is ready for review. Feedback is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs review[Status] The PR/issue is awaiting review from the maintainerweb[Component] This issue will be transferred to adk-web

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions