jonhue/turbolinks-animate

Page disappears after a click on a mailto/download link

jonhue opened this issue · 1 comments

Should have been fixed with 32ce60a.

Because of some reason it's still not working.

The same goes for download links.

We already have to set "data-turbolinks=false" on all download links so that turbolinks doesn't try to interpret the downloaded file as html. Having that attribute to rely on I just added this to your mailto fix and it seems to work:
document.querySelectorAll('a[data-turbolinks=false]').forEach((element) => element.addEventListener('click', () => ignoreBeforeunload = true));
I don't know enough about the internals of Turbolinks or TAnimate to say if this is a generic fix though.

Edit: Just found out the "download" attribute on an anchor is recognised by turbolinks and is probably a better replacement for "data-turbolinks=false".