Skip to content
Snippets Groups Projects
Commit 7bfbbcdd authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Fix shadow dom event bubbling

parent 8b63d4eb
No related branches found
No related tags found
No related merge requests found
...@@ -30,9 +30,9 @@ class VPUAuth extends LitElement { ...@@ -30,9 +30,9 @@ class VPUAuth extends LitElement {
this.personId = ""; this.personId = "";
// Create the events // Create the events
this.initEvent = new CustomEvent("vpu-auth-init", { "detail": "KeyCloak init event", bubbles: true }); this.initEvent = new CustomEvent("vpu-auth-init", { "detail": "KeyCloak init event", bubbles: true, composed: true });
this.personInitEvent = new CustomEvent("vpu-auth-person-init", { "detail": "KeyCloak person init event", bubbles: true }); this.personInitEvent = new CustomEvent("vpu-auth-person-init", { "detail": "KeyCloak person init event", bubbles: true, composed: true });
this.keycloakDataUpdateEvent = new CustomEvent("vpu-auth-keycloak-data-update", { "detail": "KeyCloak data was updated", bubbles: true }); this.keycloakDataUpdateEvent = new CustomEvent("vpu-auth-keycloak-data-update", { "detail": "KeyCloak data was updated", bubbles: true, composed: true });
} }
/** /**
...@@ -154,8 +154,7 @@ class VPUAuth extends LitElement { ...@@ -154,8 +154,7 @@ class VPUAuth extends LitElement {
*/ */
dispatchInitEvent() { dispatchInitEvent() {
this.setStateToLogin(false); this.setStateToLogin(false);
// we need to use "window", because the event doens't seem to bubble if we use "this" this.dispatchEvent(this.initEvent);
window.dispatchEvent(this.initEvent);
} }
setStateToLogin(state) { setStateToLogin(state) {
...@@ -167,16 +166,14 @@ class VPUAuth extends LitElement { ...@@ -167,16 +166,14 @@ class VPUAuth extends LitElement {
* Dispatches the person init event * Dispatches the person init event
*/ */
dispatchPersonInitEvent() { dispatchPersonInitEvent() {
// we need to use "window", because the event doens't seem to bubble if we use "this" this.dispatchEvent(this.personInitEvent);
window.dispatchEvent(this.personInitEvent);
} }
/** /**
* Dispatches the keycloak data update event * Dispatches the keycloak data update event
*/ */
dispatchKeycloakDataUpdateEvent() { dispatchKeycloakDataUpdateEvent() {
// we need to use "window", because the event doens't seem to bubble if we use "this" this.dispatchEvent(this.keycloakDataUpdateEvent);
window.dispatchEvent(this.keycloakDataUpdateEvent);
} }
updateKeycloakData() { updateKeycloakData() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment