Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

fix(Menu): stopPropagation onEscape only if needed #216

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/overlays/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ const { width } = useElementSize(activator);

const click: Ref<boolean> = ref(false);

function onLeave() {
function onLeave(event?: KeyboardEvent) {
if (!get(open))
return;

onClose();
set(click, false);
event?.stopPropagation();
}

function checkClick() {
Expand Down Expand Up @@ -141,7 +145,7 @@ const { hasError, hasSuccess } = useFormTextDetail(
</script>

<template>
<div @keydown.esc.stop="onLeave()">
<div @keydown.esc="onLeave($event)">
<div
ref="activator"
:class="[css.wrapper, wrapperClass, { 'w-full': fullWidth }]"
Expand Down
Loading