-
Notifications
You must be signed in to change notification settings - Fork 479
Description
Hi,
I have a decently sized section of a page in a Turbo Frame and it's been a great experience, everything works perfectly. I also have data-turbo-action="advance" on the frame so all link clicks within that frame update the URL.
I recently wanted to create a link with an anchor point that jumps to the bottom of the page. Imagine something like having a blog post with a <a href="#comments">View comments</a> link near the top of the post and then down near the bottom of the post you'd have <a name="comments"></a>. In this case both sides of the link are in the same frame.
When you do this inside of a Turbo Frame, clicking the link does nothing. There's no URL update and you don't jump to the anchor's name. It's like the link click gets prevented.
However, if you change your anchored link to <a href="#comments" target="_top">View comments</a> then it all works as expected. You will jump to the bottom of the page and it doesn't perform any type of request. The URL gets updated and the back button works too.
I'm happy the above works and I don't mind doing this but I wonder if there's anything at the Turbo level where maybe this could be the default behavior? Something like if you're inside of a frame and you're linking to a named anchor then break out of the frame? Or perhaps this is a bug and it should do this without needing to break out of the frame? I'm not sure, that's why I'm posting it here.