Prevent default and stop propagation when clicking artifact pill

This prevents the collapsible header from toggling when the pill is clicked.
This commit is contained in:
Mario Zechner 2025-10-08 14:17:04 +02:00
parent 8e017db924
commit 9a57aa7e1a
2 changed files with 49 additions and 47 deletions

View file

@ -3,8 +3,10 @@ import { FileCode2 } from "lucide";
import type { ArtifactsPanel } from "./artifacts.js";
export function ArtifactPill(filename: string, artifactsPanel?: ArtifactsPanel): TemplateResult {
const handleClick = () => {
const handleClick = (e: Event) => {
if (!artifactsPanel) return;
e.preventDefault();
e.stopPropagation();
// openArtifact will show the artifact and call onOpen() to open the panel if needed
artifactsPanel.openArtifact(filename);
};