@@ -669,11 +669,13 @@ if (stickyFilterBar && heroSection) {
669669 modalBody . style . width = '' ;
670670 modalBody . style . height = '' ;
671671
672- var firstChild = modalBody . firstElementChild ;
673- if ( ! firstChild ) return ;
672+ var targetEl = Array . from ( modalBody . children ) . find ( function ( el ) {
673+ return el . tagName . toLowerCase ( ) !== 'style' ;
674+ } ) || modalBody . firstElementChild ;
675+ if ( ! targetEl ) return ;
674676
675- firstChild . style . transform = '' ;
676- firstChild . style . transformOrigin = '' ;
677+ targetEl . style . transform = '' ;
678+ targetEl . style . transformOrigin = '' ;
677679
678680 var computedStyle = window . getComputedStyle ( modalContent ) ;
679681 var paddingTop = parseFloat ( computedStyle . paddingTop ) || 32 ;
@@ -684,8 +686,8 @@ if (stickyFilterBar && heroSection) {
684686 var availableHeight = modalContent . clientHeight - paddingTop - paddingBottom ;
685687 var availableWidth = modalContent . clientWidth - paddingLeft - paddingRight ;
686688
687- var contentHeight = firstChild . scrollHeight ;
688- var contentWidth = firstChild . scrollWidth ;
689+ var contentHeight = targetEl . scrollHeight ;
690+ var contentWidth = targetEl . scrollWidth ;
689691
690692 if ( contentHeight <= 0 || contentWidth <= 0 ) return ;
691693
@@ -699,8 +701,8 @@ if (stickyFilterBar && heroSection) {
699701 }
700702
701703 // Apply scale transform and origins
702- firstChild . style . transform = 'scale(' + zoom + ')' ;
703- firstChild . style . transformOrigin = 'top center' ;
704+ targetEl . style . transform = 'scale(' + zoom + ')' ;
705+ targetEl . style . transformOrigin = 'top center' ;
704706
705707 // Constrain wrapper block size to prevent scroll triggering
706708 modalBody . style . height = ( contentHeight * zoom ) + 'px' ;
@@ -718,12 +720,14 @@ if (stickyFilterBar && heroSection) {
718720 }
719721
720722 var modalBody = document . getElementById ( 'modalBody' ) ;
721- var firstChild = modalBody ? modalBody . firstElementChild : null ;
722- if ( firstChild ) {
723+ var targetEl = modalBody ? Array . from ( modalBody . children ) . find ( function ( el ) {
724+ return el . tagName . toLowerCase ( ) !== 'style' ;
725+ } ) || modalBody . firstElementChild : null ;
726+ if ( targetEl ) {
723727 modalResizeObserver = new ResizeObserver ( function ( ) {
724728 requestAnimationFrame ( applyModalScaling ) ;
725729 } ) ;
726- modalResizeObserver . observe ( firstChild ) ;
730+ modalResizeObserver . observe ( targetEl ) ;
727731 }
728732
729733 window . addEventListener ( 'resize' , applyModalScaling ) ;
0 commit comments