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

Dispatching events from custom elements #2611

Closed
colinbate opened this issue Apr 29, 2019 · 3 comments
Closed

Dispatching events from custom elements #2611

colinbate opened this issue Apr 29, 2019 · 3 comments

Comments

@colinbate
Copy link

colinbate commented Apr 29, 2019

Svelte v3.1.0
Firefox Developer Edition 67

I realize that the documentation around custom elements in v3 isn't complete, but I've been poking around the code and I'm not sure I can see a way to do what I was expecting.

Basically, I'd like to use the dispatch method returned from createEventDispatcher() to send native DOM events (element.dispatchEvent) when in a custom element situation. I'd be fine if it was something that required an option be sent to createEventDispatcher. I could probably do something with Actions or bind:this, but that feels awkward.

Essentially I would like my compiled custom element to be used in a context where it doesn't know it is coming from Svelte and therefore will be using standard DOM interaction. This doesn't feel like an unusual situation.

I've created a gist that contains all of the relevant files. If this isn't sufficient, let me know.
https://gist.github.com/colinbate/3f56197c41b2b0fc3f4e700cf7121528

@hsablonniere
Copy link

Hey Svelte team 😍

I need the exact same thing. 🙏

Should we consider options to configure composed or bubbles?

@vogloblinsky
Copy link

+1

@TehShrike
Copy link
Member

This is indeed a bug. Duplicate of #3119

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

No branches or pull requests

5 participants