@@ -165,6 +165,22 @@ function inferredMotionElement() {
165165// A single "to" tween running from t=2 to t=5 (position 2, duration 3), with
166166// keyframes on "x" at 0/50/100% — enough to drive both FlatTimingRow's
167167// inference and the Layout "x" row's keyframe-seek gutter.
168+ // Six-group fixture (fixed-headers + scrollable-open-section worked example):
169+ // tagName "img" turns on both Media and Grade (resolveEditingSections), on top
170+ // of baseElement()'s text-editable + style-editable + timing-eligible
171+ // (data-start) defaults — yielding all six groups in a known order:
172+ // [text, style, layout, motion, grade, media].
173+ function sixGroupElement ( ) {
174+ return {
175+ ...baseElement ( ) ,
176+ id : "six-group" ,
177+ selector : "#six-group" ,
178+ label : "Six Group" ,
179+ tagName : "img" ,
180+ dataAttributes : { start : "0" , duration : "4" } ,
181+ } ;
182+ }
183+
168184const INFERRED_TIMING_ANIMATION = {
169185 id : "a1" ,
170186 targetSelector : "#inferred-anim" ,
@@ -812,7 +828,7 @@ describe("PropertyPanel — pinning", () => {
812828 expect ( pinnedRow ?. textContent ) . toContain ( "Pinned" ) ;
813829
814830 // The divider must appear after the pinned zone.
815- const container = host . querySelector ( ".flex-1.overflow-y-auto" ) ;
831+ const container = host . querySelector ( '[data-flat-panel-body="true"]' ) ;
816832 const children = Array . from ( container ?. children ?? [ ] ) ;
817833 const pinnedIndex = children . indexOf ( pinnedRow as Element ) ;
818834 const dividerIndex = children . findIndex ( ( el ) => el . textContent ?. includes ( "one open below" ) ) ;
@@ -837,3 +853,95 @@ describe("PropertyPanel — pinning", () => {
837853 RENDER_TIMEOUT_MS ,
838854 ) ;
839855} ) ;
856+
857+ // design_handoff scrollable-open-section: collapsed headers before/after the
858+ // open group render in normal document flow and never move (no sticky, no
859+ // stacking offsets) — only the open group's own body content scrolls, in a
860+ // dedicated region between the two fixed header stacks. Worked example: 6
861+ // groups [text, style, layout, motion, grade, media], motion open (index 3)
862+ // -> text/style/layout render as fixed collapsed headers before it, motion
863+ // renders as an open header + scrollable body, grade/media render as fixed
864+ // collapsed headers after it — in exactly that DOM order, nothing sticky.
865+ describe ( "PropertyPanel — fixed headers + scrollable open section (Plan 11)" , ( ) => {
866+ it (
867+ "renders before-open headers, the open group (header + scrollable body), then after-open headers, in that exact order, with nothing sticky" ,
868+ async ( ) => {
869+ const { host, root } = await renderPanel ( true , sixGroupElement ( ) ) ;
870+ // sixGroupElement() opens Text by default; open Motion (index 3) to
871+ // match the worked example.
872+ openFlatGroup ( host , "Motion" ) ;
873+ expect ( openGroupText ( host ) ) . toContain ( "Motion" ) ;
874+
875+ const body = host . querySelector ( '[data-flat-panel-body="true"]' ) ;
876+ if ( ! body ) throw new Error ( "expected the flat panel body container" ) ;
877+
878+ // Titles in DOM order: each child is either a collapsed header button
879+ // (before/after the open group) or the open-group wrapper div.
880+ const titles = Array . from ( body . children ) . map ( ( child ) => {
881+ if ( child . matches ( '[data-flat-group-collapsed="true"]' ) ) return child . textContent ?? "" ;
882+ if ( child . matches ( '[data-flat-group-open="true"]' ) ) return child . textContent ?? "" ;
883+ return null ;
884+ } ) ;
885+ // Filter to just the group entries (drop nulls from any divider, none
886+ // expected here since no groups are pinned).
887+ const groupTitles = titles . filter ( ( t ) : t is string => t !== null ) ;
888+ expect ( groupTitles ) . toHaveLength ( 6 ) ;
889+ expect ( groupTitles [ 0 ] ) . toContain ( "Text" ) ;
890+ expect ( groupTitles [ 1 ] ) . toContain ( "Style" ) ;
891+ expect ( groupTitles [ 2 ] ) . toContain ( "Layout" ) ;
892+ expect ( groupTitles [ 3 ] ) . toContain ( "Motion" ) ;
893+ expect ( groupTitles [ 4 ] ) . toContain ( "Grade" ) ;
894+ expect ( groupTitles [ 5 ] ) . toContain ( "Media" ) ;
895+
896+ // The open group (Motion, index 3) is the one wrapped in
897+ // data-flat-group-open, sitting between the before/after collapsed
898+ // headers — and it must contain a dedicated scrollable body.
899+ const openWrapper = host . querySelector ( '[data-flat-group-open="true"]' ) ;
900+ if ( ! openWrapper ) throw new Error ( "expected the open-group wrapper" ) ;
901+ expect ( openWrapper . textContent ) . toContain ( "Motion" ) ;
902+ expect ( openWrapper . querySelector ( ".overflow-y-auto" ) ) . not . toBeNull ( ) ;
903+
904+ // Nothing anywhere in the panel body carries inline sticky positioning
905+ // — the entire sticky-stacking mechanism is gone.
906+ const stickyEls = Array . from ( body . querySelectorAll < HTMLElement > ( "[style]" ) ) . filter (
907+ ( el ) => el . style . position === "sticky" ,
908+ ) ;
909+ expect ( stickyEls ) . toHaveLength ( 0 ) ;
910+ act ( ( ) => root . unmount ( ) ) ;
911+ } ,
912+ RENDER_TIMEOUT_MS ,
913+ ) ;
914+
915+ it (
916+ "renders every group as a plain collapsed header with no scrollable middle region when nothing is open" ,
917+ async ( ) => {
918+ const { host, root } = await renderPanel ( true , sixGroupElement ( ) ) ;
919+ // Collapse the default-open Text group so openGroupId becomes "".
920+ const collapseButton = host . querySelector < HTMLButtonElement > (
921+ '[data-flat-group-open="true"] button[title="Collapse"]' ,
922+ ) ;
923+ act ( ( ) => collapseButton ?. dispatchEvent ( new MouseEvent ( "click" , { bubbles : true } ) ) ) ;
924+ expect ( host . querySelector ( '[data-flat-group-open="true"]' ) ) . toBeNull ( ) ;
925+
926+ const collapsedRows = Array . from (
927+ host . querySelectorAll < HTMLButtonElement > ( '[data-flat-group-collapsed="true"]' ) ,
928+ ) ;
929+ expect ( collapsedRows ) . toHaveLength ( 6 ) ;
930+ const titlesInOrder = collapsedRows . map ( ( el ) => el . textContent ?? "" ) ;
931+ expect ( titlesInOrder [ 0 ] ) . toContain ( "Text" ) ;
932+ expect ( titlesInOrder [ 1 ] ) . toContain ( "Style" ) ;
933+ expect ( titlesInOrder [ 2 ] ) . toContain ( "Layout" ) ;
934+ expect ( titlesInOrder [ 3 ] ) . toContain ( "Motion" ) ;
935+ expect ( titlesInOrder [ 4 ] ) . toContain ( "Grade" ) ;
936+ expect ( titlesInOrder [ 5 ] ) . toContain ( "Media" ) ;
937+
938+ const body = host . querySelector ( '[data-flat-panel-body="true"]' ) ;
939+ expect ( body ?. querySelector ( ".overflow-y-auto" ) ) . toBeNull ( ) ;
940+ for ( const row of collapsedRows ) {
941+ expect ( row . style . position ) . toBe ( "" ) ;
942+ }
943+ act ( ( ) => root . unmount ( ) ) ;
944+ } ,
945+ RENDER_TIMEOUT_MS ,
946+ ) ;
947+ } ) ;
0 commit comments