File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,5 +22,38 @@ async function mountSampleDetailEnhancementIfNeeded() {
2222}
2323
2424if ( typeof window !== 'undefined' && typeof document !== 'undefined' ) {
25+ const headerIntroAccordion = document . querySelector ( '.is-collapsible' ) ;
26+ const headerIntroSummary = headerIntroAccordion ?. querySelector ( '.is-collapsible__summary' ) ;
27+ const isHeaderIntroAccordion = headerIntroAccordion instanceof HTMLDetailsElement
28+ && headerIntroSummary instanceof HTMLElement
29+ && headerIntroSummary . textContent ?. trim ( ) . toLowerCase ( ) === 'header and intro' ;
30+
31+ if ( isHeaderIntroAccordion ) {
32+ headerIntroAccordion . addEventListener ( 'toggle' , async ( ) => {
33+ if ( ! document . fullscreenEnabled ) {
34+ return ;
35+ }
36+
37+ if ( headerIntroAccordion . open ) {
38+ if ( document . fullscreenElement ) {
39+ try {
40+ await document . exitFullscreen ( ) ;
41+ } catch {
42+ // Ignore fullscreen exit failures because accordion state remains usable.
43+ }
44+ }
45+ return ;
46+ }
47+
48+ if ( ! document . fullscreenElement && typeof document . documentElement ?. requestFullscreen === 'function' ) {
49+ try {
50+ await document . documentElement . requestFullscreen ( ) ;
51+ } catch {
52+ // Ignore fullscreen request failures because accordion state remains usable.
53+ }
54+ }
55+ } ) ;
56+ }
57+
2558 void mountSampleDetailEnhancementIfNeeded ( ) ;
2659}
You can’t perform that action at this time.
0 commit comments