-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Describe the bug
I have a simple button component (custom element) in which I only intercept a “click” event and trigger a “clicked” event to the outside.
Reproduction
Inside the test component:
<button onclick="{onClicked}">
<slot></slot>
</button>
Script:
const onClicked = (e: Event) => {
console.log("onCLicked");
$host().dispatchEvent(
new CustomEvent("clicked", { detail: e }),
);
};
Using:
<cow-ps-button onclicked="{() => console.log('Click 1')}">
<span>BUTTON 1 SLOT CONTENT</span>
</cow-ps-button>
If I click in the inner part of my rendered slot content (the text), no console.log(“onCLicked”);
and no console.log('Click 1')
is executed. Only if the pointer click goes to the button element of my component (but not to its slot content), all logs are output to the console.
Logs
No log ...
System Info
System:
OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (32) x64 AMD Ryzen 9 7950X3D 16-Core Processor
Memory: 9.23 GB / 30.48 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 22.7.0 - ~/.nvm/versions/node/v22.7.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v22.7.0/bin/npm
Browsers:
Brave Browser: 128.1.69.153
Chrome: 128.0.6613.84
npmPackages:
svelte: 5.0.0-next.244 => 5.0.0-next.244
Severity
annoyance