From 7b0806a2075d52be604bc085d661615451092f44 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 24 Mar 2022 17:35:55 +0100 Subject: [PATCH] Update some event emitters --- client/src/components/HeaderBar.vue | 4 +- client/src/components/UserWidget.vue | 110 ++++++++++-------- .../components/school-class/CurrentClass.vue | 33 +++--- client/src/directives/click-outside.ts | 23 ++++ 4 files changed, 105 insertions(+), 65 deletions(-) diff --git a/client/src/components/HeaderBar.vue b/client/src/components/HeaderBar.vue index 8e6fcde4..1f67bbb7 100644 --- a/client/src/components/HeaderBar.vue +++ b/client/src/components/HeaderBar.vue @@ -14,14 +14,14 @@ > diff --git a/client/src/components/UserWidget.vue b/client/src/components/UserWidget.vue index 2c8c8310..f535534a 100644 --- a/client/src/components/UserWidget.vue +++ b/client/src/components/UserWidget.vue @@ -1,70 +1,82 @@ diff --git a/client/src/components/school-class/CurrentClass.vue b/client/src/components/school-class/CurrentClass.vue index f597a993..1090b872 100644 --- a/client/src/components/school-class/CurrentClass.vue +++ b/client/src/components/school-class/CurrentClass.vue @@ -1,24 +1,29 @@ diff --git a/client/src/directives/click-outside.ts b/client/src/directives/click-outside.ts index accc24ad..af7cb083 100644 --- a/client/src/directives/click-outside.ts +++ b/client/src/directives/click-outside.ts @@ -7,6 +7,29 @@ declare global { } } +/* + todo: + there is a special interaction with nested elements where the parent has a @click event: + the parent triggers the event, something happens, but the click event bubbles to the child element. + If the event is then used to open some kind of sidebar or modal that has the `click-outside` propert, t + he bubbled event will be outside of it, thereby closing it. + + example: + + + + Hello + + + FIX: + In this example, setting the event on the a-tag as `@click.stop` will solve the problem + */ export default { unmounted(el: HTMLElement) { document.body.removeEventListener('click', el.clickOutsideEvent);