Skip to content

Shouldn't trix-change also dispatch a change event somewhere? #1241

@David-Guillot

Description

@David-Guillot

Hi there,

I've started using Trix yesterday, so please let me know if I'm missing something 😳

I'm using Trix within a <form>, and I happen to have an event listener to the form's change event. And it seems that changing something in a <trix-editor>, while dispatching a custom trix-change event, does not dispatch any native change event. I see that Trix actually modifies the value of an <input type="hidden"> (which id is associated to the trix-editor through the input attribute), but those don't fire any of input and change native events (cf MDN).

I worked around this easily by manually listening to trix-change and running:

document.getElementById(event.target.getAttribute("input")).dispatchEvent(new Event("change", {bubbles: true}))

But I guess I'm not the only one facing this, so my question is: shouldn't Trix do that by itself?

Again, if there is an option somewhere to do that and that I missed, sorry for the noise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions