-
Notifications
You must be signed in to change notification settings - Fork 425
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
Support for some other Action Options and Key Modifiers would be great #530
Comments
Yeah, I fundamentally like this syntax, and would happy to see it extended to mouse clicks as well. Do investigate. |
@dhh Sure. I'll take this up and raise an appropriate PR for it. Thanks! 🤝 |
I like this idea for I suppose we would be able to chain them ? <div data-action="click->controller#vote:once:prevent"> |
Ahh, I had thought of click.once->controller, but what you're proposing is even better, @adrienpoly. And yeah, the chaining seems very reasonable. Should still combine this with @NakajimaTakuya's work on the hotkeys and mouse modifiers, so we could have |
yes So we would :
Examples# mixing event variant and event options
<div data-action="click.left->controller#vote:once:prevent">
# with global listener
<div data-action="keydown.left@window->tabs#prevTab"> |
Just an update. I'm also implementing the |
This issue is inspired by #440, #442, and Vue's
v-on
directive. Out of the listed "Modifiers", Stimulus already has the following::capture
:once
:passive
:!passive
The
.{keyAlias}
Key Modifier is already being handled in #442 for keyboard events. We can have the equivalent.left
,.right
, and.middle
Key Modifiers for mouse events as well.On top of that, seems like having a
:self
Action Option would be great. Maybe an equivalent:!self
as well?And I know that the
:stop
and:prevent
Action Options aren't necessary since the same can be done inside the handler itself, but it'd be nice to have those options as well to reduceevent.stopPropagation()
andevent.preventDefault()
inside most handlers.Thoughts?
The text was updated successfully, but these errors were encountered: