Turbo Frames (https://turbo.hotwired.dev/handbook/frames) does this. It does mean pulling in a JavaScript library (and the user having JS enabled) but you don't have to write any.
I'd definitely love to see something like this built into the browser.
I'd definitely love to see something like this built into the browser.