mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 03:48:23 +00:00
Last week I disabled smart lists in Firefox in 2ab4913d1343b1a9b8fd131b142f89d88480fbc9. This week the same issue presented itself in Chrome. Turns out, the list modification was still not firing at the right time in the event chain. I investigated and it looks as though `beforeinput` is a better fit, since: > This allows web apps to override text edit behavior before the browser modifies the DOM tree, and provides more control over input events to improve performance. c.f. https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event and https://webkit.org/blog/7358/enhanced-editing-with-input-events/ and https://www.w3.org/TR/uievents/#events-keyboard-event-order The order of keyboard events is `keydown` -> `beforeinput` -> `input` -> `keyup` I changed to detect the event type of `insertLineBreak` which is not always consistently true in `input` events. If it's true when `beforeinput` is fired then we go ahead with the smart list when `input` fires.