@@ -152,35 +152,29 @@ const CModal = defineComponent({
152152 }
153153
154154 const handleKeyUp = ( event : KeyboardEvent ) => {
155- if (
156- modalContentRef . value &&
157- ! modalContentRef . value . contains ( event . target as HTMLElement ) &&
158- props . backdrop !== 'static'
159- ) {
160- if ( event . key === 'Escape' && props . keyboard ) {
161- return handleDismiss ( )
155+ if ( modalContentRef . value && ! modalContentRef . value . contains ( event . target as HTMLElement ) ) {
156+ if ( props . backdrop !== 'static' && event . key === 'Escape' && props . keyboard ) {
157+ handleDismiss ( )
158+ }
159+ if ( props . backdrop === 'static' ) {
160+ modalRef . value . classList . add ( 'modal-static' )
161+ setTimeout ( ( ) => {
162+ modalRef . value . classList . remove ( 'modal-static' )
163+ } , 300 )
162164 }
163- }
164- if ( props . backdrop === 'static' ) {
165- modalRef . value . classList . add ( 'modal-static' )
166- setTimeout ( ( ) => {
167- modalRef . value . classList . remove ( 'modal-static' )
168- } , 300 )
169165 }
170166 }
171167 const handleClickOutside = ( event : Event ) => {
172- if (
173- modalContentRef . value &&
174- ! modalContentRef . value . contains ( event . target as HTMLElement ) &&
175- props . backdrop !== 'static'
176- ) {
177- handleDismiss ( )
178- }
179- if ( props . backdrop === 'static' ) {
180- modalRef . value . classList . add ( 'modal-static' )
181- setTimeout ( ( ) => {
182- modalRef . value . classList . remove ( 'modal-static' )
183- } , 300 )
168+ if ( modalContentRef . value && ! modalContentRef . value . contains ( event . target as HTMLElement ) ) {
169+ if ( props . backdrop !== 'static' ) {
170+ handleDismiss ( )
171+ }
172+ if ( props . backdrop === 'static' ) {
173+ modalRef . value . classList . add ( 'modal-static' )
174+ setTimeout ( ( ) => {
175+ modalRef . value . classList . remove ( 'modal-static' )
176+ } , 300 )
177+ }
184178 }
185179 }
186180
0 commit comments