mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

onInput and onKeyDown sequencing issue

Open weikequ opened this issue 1 year ago • 0 comments

Description

  • When both onInput and onKeyDown is used, onKeyDown should always fire before onInput, but with mathlive with React (not 100% sure if its caused by React), the order is switched with Backspace, Delete, and maybe others that I haven't tested. With Enter, the onKeyDown handler 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

  1. Create a react project,
  2. Add in a mathlive element and a textarea element with oninput and onkeydown handlers that return a timestamp
  3. 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

weikequ avatar May 10 '24 18:05 weikequ