feat : fermeture du MalioDrawer avec la touche Échap

This commit is contained in:
2026-05-21 16:35:46 +02:00
parent cfdc404871
commit f443803327
2 changed files with 21 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
:aria-label="hasHeader ? undefined : (ariaLabel || undefined)"
tabindex="-1"
data-test="panel"
@keydown="onKeydown"
>
<div
v-if="hasHeader || showClose"
@@ -142,6 +143,13 @@ function onBackdropClick() {
if (props.dismissable) close()
}
function onKeydown(e: KeyboardEvent) {
if (e.key === 'Escape' && props.closeOnEscape) {
e.stopPropagation()
close()
}
}
function close() {
if (!isControlled.value) localValue.value = false
emit('update:modelValue', false)