react-image-crop icon indicating copy to clipboard operation
react-image-crop copied to clipboard

Fix meta shortcuts

Open mskelton opened this issue 3 years ago • 0 comments

Fixes #503 Reverts #388

So, as it turns out, the OS will take over when the meta key is pressed such that keyup events won't be registered when you release an arrow key if the meta key is still pressed. This resulted in the keysDown set still having a key which is no longer pressed that is supposedly down.

The two solutions I see are:

  1. Clear the set when any keyup event occurs. This maintains partial functionality for multi-directional nudging, but as soon as you release any key (e.g. shift, meta, etc.), you will be back to only nudging in the last direction.
  2. Revert the behavior to single direction nudging. This is what I went with as it's the most consistent behavior, albeit a slight degradation in user experience.

Thoughts?

mskelton avatar Aug 02 '22 20:08 mskelton