Escape when in the main modal closes the modal

This commit is contained in:
Alexander Brown
2026-01-16 19:24:20 -08:00
parent f2365f55b2
commit 0289cc8c65

View File

@@ -1,5 +1,8 @@
<template>
<div class="base-widget-layout rounded-2xl overflow-hidden relative">
<div
class="base-widget-layout rounded-2xl overflow-hidden relative"
@keydown.esc.capture="handleEscape"
>
<div class="flex h-full w-full">
<Transition name="slide-panel">
<nav
@@ -166,6 +169,13 @@ const toggleLeftPanel = () => {
const toggleRightPanel = () => {
isRightPanelOpen.value = !isRightPanelOpen.value
}
function handleEscape(event: KeyboardEvent) {
if (isRightPanelOpen.value) {
event.stopPropagation()
isRightPanelOpen.value = false
}
}
</script>
<style scoped>
.base-widget-layout {