forked from hotwired/turbo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Dispatch
turbo:click
when driving a Frame
Closes hotwired#726 Prior to this commit, clicking on `<a>` elements nested within `<turbo-frame>` elements, or `<a>` elements that drive `<turbo-frame>` elements did not dispatch `turbo:click` events in the same way that they did before [hotwired#412][]. This commit re-instates those events as part of the `FrameController` and `FrameRedirector` implementations for the `willFollowLinkToLocation` methods they define as part of the `LinkClickObserverDelegate` interface. To be consistent with the existing `turbo:click` dispatch behavior, and to guard against introducing similar regressions in the future, this commit also adds test coverage for falling back to page-wide navigations when `turbo:click` events are canceled. In support of those changes, first, introduce the `cancelNextEvent` helper to accept the name of a Turbo event that is cancellable (in this case, `turbo:click` and `turbo:before-visit`). Next, implement `cancelNextVisit` in terms of `cancelNextEvent`. Finally, use the `cancelNextEvent` helper in the Frame test coverage to ensure that canceling a `turbo:click` prevents navigating the Frame and falls back to built-in browser behavior. [hotwired#412]: hotwired#412
- Loading branch information
1 parent
33617b7
commit 6227e4f
Showing
7 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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