You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to jot down the reasons behind the decision to use MutationObserver as the main input recognition channel with input event as the fallback. Also note, this is implemented as a module (input) and can be replaced in the future or on a case-by-case basis if we find better solutions and as browsers progress.
The Android keyboard GBoard is buggy and doesn't fire the events it should for contenteditable changes. For this reason and the greatest compatibility with autocomplete and text-composition, we use MutationObserver to know when content has been edited within the editor.
Firefox has had issues with MutationObserver in the past and it sometimes just stops firing. So I've added a fallback for the input event which will take over when mutation observer doesn't work. They are idempotent, so In the event they both handle the same change no unhappy side-affects will occur.
Browsers have come a long way, but we still have to handle browser-specific (or sometimes mobile-keyboard-specific) issues in our libraries. Especially with contenteditable.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I wanted to jot down the reasons behind the decision to use MutationObserver as the main input recognition channel with input event as the fallback. Also note, this is implemented as a module (
input
) and can be replaced in the future or on a case-by-case basis if we find better solutions and as browsers progress.The Android keyboard GBoard is buggy and doesn't fire the events it should for contenteditable changes. For this reason and the greatest compatibility with autocomplete and text-composition, we use MutationObserver to know when content has been edited within the editor.
Firefox has had issues with MutationObserver in the past and it sometimes just stops firing. So I've added a fallback for the
input
event which will take over when mutation observer doesn't work. They are idempotent, so In the event they both handle the same change no unhappy side-affects will occur.Browsers have come a long way, but we still have to handle browser-specific (or sometimes mobile-keyboard-specific) issues in our libraries. Especially with contenteditable.
Beta Was this translation helpful? Give feedback.
All reactions