I am using a custom renderer with Turbo Frames (specifically morphdom) which manages maintaining focus. However, if any element in the new set have an autofocus attribute they will steal focus after the render due to the behavior of FrameRenderer:
Proposal is to add an autofocus attribute to the turbo-frame element (with a default of true) – similar to way you can control the auto scrolling behavior:
Hi @mkdynamic, this is not possible. You can do scroll to a Turbo frame, but a Turbo frame is not focusable, so it doesn't make much sense to do this. Closing for now
I am using a custom renderer with Turbo Frames (specifically
morphdom
) which manages maintaining focus. However, if any element in the new set have anautofocus
attribute they will steal focus after the render due to the behavior ofFrameRenderer
:https://github.com/hotwired/turbo/blob/da647a63950c6f834fb0fbcf9315bee2be408cbe/src/core/frames/frame_renderer.ts#L42-L52
Proposal is to add an
autofocus
attribute to theturbo-frame
element (with a default oftrue
) – similar to way you can control the auto scrolling behavior:https://turbo.hotwired.dev/reference/frames#html-attributes