File tree 1 file changed +10
-0
lines changed
packages/vuetify/src/components/VOverlay
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export const VOverlay = genericComponent<OverlaySlots>()({
129
129
emits : {
130
130
'click:outside' : ( e : MouseEvent ) => true ,
131
131
'update:modelValue' : ( value : boolean ) => true ,
132
+ keydown : ( e : KeyboardEvent ) => true ,
132
133
afterEnter : ( ) => true ,
133
134
afterLeave : ( ) => true ,
134
135
} ,
@@ -218,6 +219,9 @@ export const VOverlay = genericComponent<OverlaySlots>()({
218
219
219
220
function onKeydown ( e : KeyboardEvent ) {
220
221
if ( e . key === 'Escape' && globalTop . value ) {
222
+ if ( ! contentEl . value ?. contains ( document . activeElement ) ) {
223
+ emit ( 'keydown' , e )
224
+ }
221
225
if ( ! props . persistent ) {
222
226
isActive . value = false
223
227
if ( contentEl . value ?. contains ( document . activeElement ) ) {
@@ -226,6 +230,11 @@ export const VOverlay = genericComponent<OverlaySlots>()({
226
230
} else animateClick ( )
227
231
}
228
232
}
233
+ function onKeydownSelf ( e : KeyboardEvent ) {
234
+ if ( e . key === 'Escape' && ! globalTop . value ) return
235
+
236
+ emit ( 'keydown' , e )
237
+ }
229
238
230
239
const router = useRouter ( )
231
240
useToggleScope ( ( ) => props . closeOnBack , ( ) => {
@@ -309,6 +318,7 @@ export const VOverlay = genericComponent<OverlaySlots>()({
309
318
props . style ,
310
319
] }
311
320
ref = { root }
321
+ onKeydown = { onKeydownSelf }
312
322
{ ...scopeId }
313
323
{ ...attrs }
314
324
>
You can’t perform that action at this time.
0 commit comments