-
Notifications
You must be signed in to change notification settings - Fork 424
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
Feature request: allow extending defaultEventNames
mapping
#660
Comments
Thanks for opening this issue @grncdr! I wouldn't be opposed to add support for something like this. I think it would make sense to provide some sort of public interface instead of just exporting the object. |
grncdr
added a commit
to grncdr/stimulus
that referenced
this issue
Feb 17, 2023
This allows configure default events for arbitrary elements. Closes hotwired#660
grncdr
added a commit
to grncdr/stimulus
that referenced
this issue
Feb 17, 2023
This allows applications to extend the mapping with support for custom elements. Closes hotwired#660
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The logic for shorthand/default event names in stimulus is currently defined here:
stimulus/src/core/action.ts
Lines 89 to 97 in f7bfc35
This is pretty handy, but if you are using a library of custom elements (e.g. shoelace) you have to turn
<button data-action="controller#method"></button>
into<sl-button data-action="click->controller#method"></sl-button>
.It's a tiny thing, but if stimulus were to simply export that mapping it would be possible for users to do something like:
If exporting the mapping directly is exposing too many implementation details, a function like
setDefaultEventName(elementName, stringOrCallback)
would also be pretty nice.If that makes sense to the maintainers I can take a crack at a PR.
The text was updated successfully, but these errors were encountered: