@@ -2360,6 +2360,32 @@ describe("layout-audit.browser content overlap", () => {
23602360 } ) ;
23612361 } ) ;
23622362
2363+ it ( "never reads inside a scene the runtime hid" , ( ) => {
2364+ document . body . innerHTML = `
2365+ <div id="root" data-composition-id="main" data-width="1920" data-height="1080">
2366+ <div id="host" data-hf-clip-hidden style="visibility: hidden"><div id="a">Later scene line</div></div>
2367+ <div id="b">Current scene line</div>
2368+ </div>
2369+ ` ;
2370+ installOverlapStyles (
2371+ { a : "rgb(0, 0, 0)" , b : "rgb(0, 0, 0)" } ,
2372+ { a : "none" , b : "none" } ,
2373+ { } ,
2374+ { host : "hidden" , a : "visible" , b : "visible" } ,
2375+ ) ;
2376+ installOverlapGeometry ( {
2377+ a : [ rect ( { left : 100 , top : 100 , width : 400 , height : 100 } ) ] ,
2378+ b : [ rect ( { left : 300 , top : 120 , width : 400 , height : 100 } ) ] ,
2379+ } ) ;
2380+ installAuditScript ( ) ;
2381+
2382+ const audit = ( window as unknown as { __hyperframesOverlapAudit : OverlapAudit } )
2383+ . __hyperframesOverlapAudit ;
2384+ expect ( audit ( { time : 1 } ) ) . toEqual ( [ ] ) ;
2385+ const read = vi . mocked ( window . getComputedStyle ) . mock . calls . map ( ( [ element ] ) => element . id ) ;
2386+ expect ( read ) . not . toContain ( "a" ) ;
2387+ } ) ;
2388+
23632389 // A typewriter span clipped to nothing (clip-path: inset(0 100% 0 0)) keeps a
23642390 // normal box but paints zero pixels; overlapping it must not flag the visible
23652391 // block beneath. The clipped element is unreachable by elementFromPoint, which
@@ -3726,6 +3752,8 @@ interface AuditIssue {
37263752 coveredFraction ?: number ;
37273753}
37283754
3755+ type OverlapAudit = ( options : { time : number } ) => AuditIssue [ ] ;
3756+
37293757function runAudit ( options ?: { proseCoverageFloor ?: number } ) : AuditIssue [ ] {
37303758 const audit = (
37313759 window as unknown as {
0 commit comments