shinokada / svelte-5-ui-lib

A UI library crafted for Svelte 5: Runes
https://svelte-5-ui-lib.codewithshin.com
MIT License
102 stars 13 forks source link

Onclick ListgroupItem not working as expected #21

Closed timblommerde closed 1 month ago

timblommerde commented 1 month ago

Describe the bug

If you provide a 'Listgroup' components with a collection of items that have their 'onclick' property set, those 'onclick' events aren't fired when the actual item is clicked. The reason is that the 'onclick' on the 'Listgroup' always "overwrites" the 'onclick' of the items.

Reproduction

https://github.com/timblommerde/svelte5ui-listgroup-bugexample

This repo also contains a small fix for the problem.

Version and System Info

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 151.39 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
  Browsers:
    Chrome: 128.0.6613.139
    Safari: 17.6
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.5.28 
    svelte: ^5.0.0-next.1 => 5.0.0-next.257 
    svelte-5-ui-lib: ^0.9.12 => 0.9.12 
    vite: ^5.4.6 => 5.4.6
shinokada commented 1 month ago

Thank you for providing the fix. I will add it to the next release.