Turbo Stream Targeting Error Inside Nested Turbo Frames
0 reputation · 16 May 2025, 02:44 UTC
Turbostream Targeting Error Inside Nested Turbo Frames
The goal is to determine whether a Turbo Stream action that references an element inside an inner Turbo Frame actually updates that inner frame’s content or instead applies to the outer frame’s DOM. The current Turbo specification lists selector resolution but omits a clear rule for nested frames, and different releases (7.0, 7.1, 7.2) have shown inconsistent behavior.
Key constraints include potential ID collisions between frames, variations in how browsers expose the inner frame’s DOM to the parent, and the fact that some implementations treat the selector as relative to the outer frame while others resolve it to the inner frame that is currently rendered.
Unresolved questions that need verification across Turbo releases are:
1. When a Turbo Stream targets an element inside an inner frame, does the action apply to that element within the inner frame’s DOM or does it lift the target to the outer frame’s document?
2. How do overlapping element IDs across nested frames affect selector resolution in Turbo Streams?