[Bug]: clicking on the svg won't switch the theme
Closed this issue · 1 comments
giacomocerquone commented
Hey there.
Using your playground https://stackblitz.com/edit/github-jpfnv9-ep5z59?file=src%2Fpages%2Findex.astro you will notice that if you start clicking exclusively on the icon, and not on the button, the theme won't switch.
Check the video:
Screenity.video.-.Mar.30.2024.mp4
That's because using e.target
will give you the exact element the user has clicked on which might not be the button and, consequently, you'll lose the correct value of the value
attribute you set.
You need to use e.currentTarget
surjithctly commented
Thanks for the bug & PR. #8 is merged