Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigate when
<dialog>
element closes
When viewing seats through the page's modal `<dialog>` element, closing the modal does not update the page's URL. This means that after viewing a Seat's details early on in a session, a User can navigate back to the Seats index, filter seats, remove Seats from their cart. The whole time they're taking action, they might not update the URL's path. If they were to reload the page, they might be surprised to re-visit the last selected seat's details in a modal `<dialog>` element. This commit replaces the `<form method="dialog">` element with an `<a>` element that links to the `/venues/:venue_id/floors/:floor_id/seats` URL. Additionally, this commit handles the [`<dialog>`'s `cancel` event][cancel] that's triggered by <kbd>esc</kbd>, by introducing the `dialog_controller.js` file and declaring the `data-action="cancel->dialog#cancel"` attribute to route events to the `dialog#cancel` function. Once events are routed to `cancel`, invoke [`Turbolinks.visit`][visit] with the value of `data-return-to-url`. In a JavaScript-disabled environment, clicking the "Close" button will navigate the user back to the Seats index, but a <kbd>esc</kbd> will not. Whoops! [cancel]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event [visit]: https://github.com/turbolinks/turbolinks#turbolinksvisit
- Loading branch information