-
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
Adds new Action Options, namely :stop
and :prevent
#535
Merged
dhh
merged 11 commits into
hotwired:main
from
radiantshaw:stop-and-prevent-action-options
Apr 30, 2022
Merged
Adds new Action Options, namely :stop
and :prevent
#535
dhh
merged 11 commits into
hotwired:main
from
radiantshaw:stop-and-prevent-action-options
Apr 30, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... by specifying the event explicitly.
... by using the words "implicit" and "explicit" instead of "default" and "specified".
adrienpoly
reviewed
Apr 14, 2022
radiantshaw
commented
Apr 22, 2022
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [turbo-events]: https://turbo.hotwired.dev/reference/events
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events
seanpdoyle
added a commit
to seanpdoyle/stimulus
that referenced
this pull request
Jul 28, 2022
As a follow-up to [hotwired#535][] and [hotwired#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [hotwired#535]: hotwired#535 [hotwired#546]: hotwired#546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events
dhh
pushed a commit
that referenced
this pull request
Jul 28, 2022
* Support custom Action Options As a follow-up to [#535][] and [#546][], add support for declaring custom action modifiers in the same style as `:prevent`, `:stop`, and `:self`. Take, for example, the [toggle][] event. It's dispatched whenever a `<details>` element toggles either open or closed. If an application were able to declare a custom `open` modifier, it could choose to route `toggle` events denoted with `:open` _only_ when the `<details open>`. Inversely, they could choose to route `toggle` events denoted with `:!open` _only_ when the `<details>` does not have `[open]`. Similarly, the same kind of customization could apply to custom events. For example, the [turbo:submit-end][turbo-events] fires after a `<form>` element submits, but does not distinguish between success or failure. A `:success` modifier could skip events with an unsuccessful HTTP response code. [#535]: #535 [#546]: #546 [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event [turbo-events]: https://turbo.hotwired.dev/reference/events * attempt to pass on Safari@14 failing test: https://github.com/hotwired/stimulus/runs/7566084180?check_suite_focus=true#step:6:138
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two new Action Options, namely
:stop
and:prevent
, as discussed in #530. For more context, please refer to the original issue.Please do not hesitate to give any suggestions and I'll make sure to accommodate those.
NOTE: For some of the other things discussed in #530, I'll do them in a separate PR.