Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: <a/> links not working properly in <Dialog/> #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JorensM
Copy link

@JorensM JorensM commented Mar 31, 2024

This PR fixes an issue where clicking on an <a/> element that is inside a <Dialog/> caused a full page reload due to the fact that <Dialog/> had a click handler that called e.stopPropogation(). <a/> elements have a native Svelte event handler attached to them, which was being ignored due to e.stopPropogation(). This PR conditionally applies e.stopPropogation() unless the clicked element is not an <a/> element.

Copy link

vercel bot commented Mar 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-headlessui-kf6d ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2024 9:04am

@stepanorda
Copy link

Is there any reason why it has stopPropogation in the first place?
Anyway, this workaround is greatly appreciated and would solve #162

@JorensM
Copy link
Author

JorensM commented Apr 23, 2024

Is there any reason why it has stopPropogation in the first place? Anyway, this workaround is greatly appreciated and would solve #162

Not sure why it's there honestly, but I guess better to leave it in case it is actually needed for some reason.

@Loizzus
Copy link

Loizzus commented Jun 30, 2024

I have created a new fork for us to share so we can fix these issues: https://github.com/PyongyangOpenSource/svelte-headlessui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants