Idea: Allow data-turbo-frame to be set on parent element

I’m running into some issues where the links in user-submitted comments don’t load properly because they are within a turbo frame. Rather than processing these comments and adding data-turbo-frame="_top" to every link, I was hoping to set data-turbo-frame="_top" once on a wrapper DIV and have it apply to all its children.

Unfortunately this seems to be ignored and the attribute needs to be set on every individual anchor tag. I wonder if this would be a nice feature for a future version of Turbo?

I’m aware we can add target="_top" to our turbo frames, but then we end up with the opposite problem. Where you need to set data-turbo-frame="foobar" on every link, button, and form that needs to happen within the frame. This complicates things a lot when you have a bunch of nested view partials and you need to keep passing the turbo frame ID to each and every one of them.

Instead of a wrapper div, have you tried a wrapper turbo frame with target="_top"?