Lit Element - a dispatched event in the child is not be received in the parent

134 views Asked by At

I am using Lit and I am dispatching an event from child to parent, but the parent does not see the event.

In the parent I have

connectedCallback() {
    super.connectedCallback()
    this.addEventListener('info-updated', this._updateInfo);
}

_updateInfo(e) {
    console.log(e)
}

In the child I have:

_updateInfo () {
    const infoUpdated = new CustomEvent('info-updated', {
        bubbles: true,
        composed: true,
        detail: { ...  some info }
    });
    this.dispatchEvent(infoUpdated);
    console.log('Dispatched');
}

_updateInfo is triggered by clicking a button in the child. The dispatch is made, but not received in the parent.

What am I doing wrong?

I have also tried:

this.addEventListener('info-updated', this._updateInfo.bind(this));
0

There are 0 answers