fix(ui): prevent tabnabbing in chat images (#18685)

* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
This commit is contained in:
Mariana Sinisterra
2026-02-24 07:56:08 -05:00
committed by GitHub
parent 66e61ca6ce
commit 649d141527

View File

@@ -200,6 +200,13 @@ function renderMessageImages(images: ImageBlock[]) {
return nothing;
}
const openImage = (url: string) => {
const opened = window.open(url, "_blank", "noopener,noreferrer");
if (opened) {
opened.opener = null;
}
};
return html`
<div class="chat-message-images">
${images.map(
@@ -208,7 +215,7 @@ function renderMessageImages(images: ImageBlock[]) {
src=${img.url}
alt=${img.alt ?? "Attached image"}
class="chat-message-image"
@click=${() => window.open(img.url, "_blank")}
@click=${() => openImage(img.url)}
/>
`,
)}