mathlive
mathlive copied to clipboard
onInput and onKeyDown sequencing issue
Description
- When both
onInputandonKeyDownis used,onKeyDownshould always fire beforeonInput, but with mathlive with React (not 100% sure if its caused by React), the order is switched withBackspace,Delete, and maybe others that I haven't tested. WithEnter, theonKeyDownhandler is not fired at all. - Edit: This is reproducible without react as well, see this codepen.
Steps to Reproduce
Visit this codepen: https://codepen.io/weikequ/pen/bGyGyEy?editors=1111
or
- Create a react project,
- Add in a mathlive element and a textarea element with oninput and onkeydown handlers that return a timestamp
- Observe differences in behaviour when using the keys mentioned above.
Actual Behavior
The order of the event handlers would be messed up or not fire at all (with Enter).
Expected Behavior
The order of the event handlers should always read onKeyDown first.
Environment
Latest version through unpkg.com
Operating System macOS 14.2.1
Browser Tested with Safari, Chromium (Electron), Firefox