@@ -89,6 +89,8 @@ export function execute(id, open) {
8989 const dw = Data . get ( id )
9090 const { el, body } = dw
9191 const drawerBody = el . querySelector ( '.drawer-body' )
92+ const drawerBackdrop = el . querySelector ( '.drawer-backdrop' )
93+ const animationFrame = getComputedStyle ( drawerBody ) . getPropertyValue ( 'transition' ) !== 'none' ;
9294
9395 let start = void 0
9496 const show = ts => {
@@ -100,10 +102,17 @@ export function execute(id, open) {
100102 requestAnimationFrame ( show ) ;
101103 }
102104 else {
103- drawerBody . classList . add ( 'show' ) ;
104- el . focus ( ) ;
105+ showDrawer ( ) ;
105106 }
106107 }
108+
109+ const showDrawer = ( ) => {
110+ drawerBody . classList . add ( 'show' ) ;
111+ if ( drawerBackdrop ) {
112+ drawerBackdrop . classList . add ( 'show' ) ;
113+ }
114+ el . focus ( ) ;
115+ }
107116
108117 const hide = ts => {
109118 if ( start === void 0 ) {
@@ -114,8 +123,7 @@ export function execute(id, open) {
114123 requestAnimationFrame ( hide ) ;
115124 }
116125 else {
117- el . classList . remove ( 'show' )
118- body . classList . remove ( 'drawer-overflow-hidden' )
126+ el . classList . remove ( 'show' ) ;
119127 }
120128 }
121129
@@ -126,12 +134,28 @@ export function execute(id, open) {
126134 if ( scroll === false ) {
127135 body . classList . add ( 'drawer-overflow-hidden' ) ;
128136 }
129- requestAnimationFrame ( show )
137+
138+ if ( animationFrame ) {
139+ requestAnimationFrame ( show )
140+ }
141+ else {
142+ showDrawer ( ) ;
143+ }
130144 }
131145 else if ( el . classList . contains ( 'show' ) ) {
132- drawerBody . classList . remove ( 'show' )
133- requestAnimationFrame ( hide )
146+ drawerBody . classList . remove ( 'show' ) ;
147+ if ( drawerBackdrop ) {
148+ drawerBackdrop . classList . remove ( 'show' ) ;
149+ }
150+ body . classList . remove ( 'drawer-overflow-hidden' ) ;
151+ if ( animationFrame ) {
152+ requestAnimationFrame ( hide )
153+ }
154+ else {
155+ el . classList . remove ( 'show' ) ;
156+ }
134157 }
158+ return animationFrame ;
135159}
136160
137161export function dispose ( id ) {
0 commit comments