Skip to content

Commit

Permalink
fix(Menu): stopPropagation onEscape only if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lukicenturi authored and kelsos committed Jun 20, 2024
1 parent bc817c6 commit bcce854
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit bcce854

Please sign in to comment.