GDB icon indicating copy to clipboard operation
GDB copied to clipboard

Realtime doesn't work on contenteditable fields in Internet Explorer

Open JohnLouderback opened this issue 10 years ago • 4 comments

The "input" event does not fire on contenteditable fields in Internet Explorer despite the fact the Internet Explorer 9+ supports the "input" event. Because IE supports the "input" event, the "keyup" fallback does not occur. A potential fix for this could be falling back on "keyup" if the browser is IE. This fix does still have its caveats, however. This does not account for context menu options such as "cut, "paste", and "delete" and is thus not entire ideal. Further research will be needed.

JohnLouderback avatar Mar 28 '14 01:03 JohnLouderback

@JohnLouderback Might be worthwhile looking at the MutationObserver object to monitor for cut, paste and delete events outside of keyup.

userabuser avatar May 23 '14 19:05 userabuser

Hi, I'll look into this. Thanks for the input! -John

JohnLouderback avatar May 25 '14 22:05 JohnLouderback

No worries...

I may end up writing a patch and submitting a PR for you by end of next week on this issue as I am approaching the need to have real time contenteditable fields working in IE9+. If you've already started work on this let me know.

While I still think the MutationObserver is the best approach, there are alternatives such as leveraging the cut, copy, paste and delete events using jQuery.on or natively if you prefer oncut, onpaste, oncopy, ondelete using attachEvent or cut, copy, paste, delete with addEventListener (for IE9+).

userabuser avatar Jun 07 '14 10:06 userabuser

Sorry for the delay! I've recently moved across the country. The biggest trick is determining when to use the MutationObserver since oninput works in other browsers and in IE9 except on contenteditable fields. Though I could just determine is the browser is IE9+ and respond accordingly.

JohnLouderback avatar Jun 07 '14 21:06 JohnLouderback