Skip to content

Commit

Permalink
fix(Alert): fixed automatic dismissal with timeout not requiring mous…
Browse files Browse the repository at this point in the history
…eover or element focus to trigger
  • Loading branch information
mtorromeo committed Jan 30, 2024
1 parent f799dca commit 939a5f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/components/Alert/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let timer: number | undefined = undefined;
let animationTimer: number | undefined = undefined;
const isMouseOver = ref(false);
const timedOut = ref(false);
const timedOutAnimation = ref(false);
const timedOutAnimation = ref(true);
const containsFocus = ref(false);
const el: Ref<HTMLDivElement | null> = ref(null);
Expand Down Expand Up @@ -186,8 +186,11 @@ onMounted(() => {
document.addEventListener('focus', onDocumentFocus, true);
watch(() => [containsFocus.value, isMouseOver.value], () => {
if (!containsFocus.value || !isMouseOver.value) {
if (!containsFocus.value && !isMouseOver.value) {
animationTimer = setTimeout(() => (timedOutAnimation.value = true), props.timeoutAnimation);
} else {
clearTimeout(animationTimer);
timedOutAnimation.value = false;
}
});
});
Expand Down

0 comments on commit 939a5f5

Please sign in to comment.