@@ -1195,11 +1195,9 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
11951195 aria_default . focusFirst ( this . el ) ;
11961196 }
11971197 } ) ;
1198- if ( ! this . el . contains ( document . activeElement ) ) {
1199- this . el . addEventListener ( "phx:show-end" , ( ) => this . el . focus ( ) ) ;
1200- if ( window . getComputedStyle ( this . el ) . display !== "none" ) {
1201- aria_default . focusFirst ( this . el ) ;
1202- }
1198+ this . el . addEventListener ( "phx:show-end" , ( ) => this . el . focus ( ) ) ;
1199+ if ( window . getComputedStyle ( this . el ) . display !== "none" ) {
1200+ aria_default . focusFirst ( this . el ) ;
12031201 }
12041202 }
12051203 }
@@ -2831,10 +2829,10 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
28312829 view . liveSocket . pushHistoryPatch ( e , href , replace ? "replace" : "push" , sourceEl ) ;
28322830 } ,
28332831 exec_focus ( e , eventType , phxEvent , view , sourceEl , el ) {
2834- aria_default . attemptFocus ( el ) ;
2832+ window . requestAnimationFrame ( ( ) => aria_default . attemptFocus ( el ) ) ;
28352833 } ,
28362834 exec_focus_first ( e , eventType , phxEvent , view , sourceEl , el ) {
2837- aria_default . focusFirstInteractive ( el ) || aria_default . focusFirst ( el ) ;
2835+ window . requestAnimationFrame ( ( ) => aria_default . focusFirstInteractive ( el ) || aria_default . focusFirst ( el ) ) ;
28382836 } ,
28392837 exec_push_focus ( e , eventType , phxEvent , view , sourceEl , el ) {
28402838 window . requestAnimationFrame ( ( ) => focusStack . push ( el || sourceEl ) ) ;
@@ -2940,14 +2938,18 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
29402938 }
29412939 } else {
29422940 if ( this . isVisible ( el ) ) {
2943- el . dispatchEvent ( new Event ( "phx:hide-start" ) ) ;
2944- dom_default . putSticky ( el , "toggle" , ( currentEl ) => currentEl . style . display = "none" ) ;
2945- el . dispatchEvent ( new Event ( "phx:hide-end" ) ) ;
2941+ window . requestAnimationFrame ( ( ) => {
2942+ el . dispatchEvent ( new Event ( "phx:hide-start" ) ) ;
2943+ dom_default . putSticky ( el , "toggle" , ( currentEl ) => currentEl . style . display = "none" ) ;
2944+ el . dispatchEvent ( new Event ( "phx:hide-end" ) ) ;
2945+ } ) ;
29462946 } else {
2947- el . dispatchEvent ( new Event ( "phx:show-start" ) ) ;
2948- let stickyDisplay = display || this . defaultDisplay ( el ) ;
2949- dom_default . putSticky ( el , "toggle" , ( currentEl ) => currentEl . style . display = stickyDisplay ) ;
2950- el . dispatchEvent ( new Event ( "phx:show-end" ) ) ;
2947+ window . requestAnimationFrame ( ( ) => {
2948+ el . dispatchEvent ( new Event ( "phx:show-start" ) ) ;
2949+ let stickyDisplay = display || this . defaultDisplay ( el ) ;
2950+ dom_default . putSticky ( el , "toggle" , ( currentEl ) => currentEl . style . display = stickyDisplay ) ;
2951+ el . dispatchEvent ( new Event ( "phx:show-end" ) ) ;
2952+ } ) ;
29512953 }
29522954 }
29532955 } ,
0 commit comments