basecamp / basecamp/trix

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

Open
#1,241 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

Hi there,

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

I'm using Trix within a ``, and I happen to have an event listener to the form's `change` event. And it seems that changing something in a ``, while dispatching a custom `trix-change` event, does not dispatch any native `change` event. I see that Trix actually modifies the value of an `` (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](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/hidden)).

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

```javascript
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the trix-change event and the hidden input referenced by the editor's input attribute, then trace how changes reach the containing form. Compare the current native event behavior with the requested behavior and review the relevant Trix event tests or documentation if available. Done would require a clear decision on whether Trix should dispatch change and corresponding coverage or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.