fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.31k stars 117 forks source link

Bubble synthetic event so more websites can catch them #195

Closed luisherranz closed 3 years ago

luisherranz commented 3 years ago

There are some client-side JavaScript frameworks like React or Ember that without the bubbles: true option in the input event don't trigger its own onChange events when the input changes.

Two examples are of websites that don't work without this option are the email editor of frontapp.com and the post editor of all the Discourse forums. I'm sure there will be many more 🙂

fregante commented 3 years ago

Good point, I think this applies to every event. Could you add {bubbles: true} to all of them?

luisherranz commented 3 years ago

What events, KeyboardEvent and CompositionEvent?

https://github.com/GhostText/GhostText/blob/6cb9670f813e387edb7452767350bfa56d75245c/source/ghost-text.js#L163-L172

fregante commented 3 years ago

All 5 of them

fregante commented 3 years ago

Note to self: Wait for Firefox to accept the current version before merging this and releasing a new version.

luisherranz commented 3 years ago

I don't think that KeyboardEvent and CompositionEvent can bubble.

fregante commented 3 years ago

The KeyboardEventInit dictionary also accepts fields from the UIEventInit and EventInit dictionaries.

Note: The CompositionEventInit dictionary inherits from the UIEventInit dictionary, so can also accept members defined on there.

The UIEventInit dictionary also accepts fields from the EventInit dictionary.

eventInit Optional This is an EventInit dictionary, having the following optional fields:

bubbles Optional A Boolean indicating whether the event bubbles. The default is false.

luisherranz commented 3 years ago

Done 👍

fregante commented 3 years ago

Thank you Luis!

luisherranz commented 3 years ago

No problem! 🙂👍