I have a page with a text editor that has attached an event like this:
action: 'beforeunload@window->editor#leaving turbo:before-visit@window->editor#leaving'
Basically it detects when the user tries to leave that page (editor) and it informs the user if they have unsaved changes. It prevents the user from accidentally leaving a document without saving it first.
It works in general, however turbo:before-visit
is not triggered when the user clicks the browser back button.
What event should I listen for?