primereact icon indicating copy to clipboard operation
primereact copied to clipboard

InputNumber: onChange and onValueChange events are not triggered when using keyboard shortcut for "cut" action

Open KubaGorka opened this issue 1 year ago • 1 comments

Describe the bug

The onChange and onValueChange events associated with an input field fail to trigger in two scenarios:

  1. When attempting to cut all numbers using a keyboard shortcut (e.g., Ctrl + X) after selecting all text in the input field the event is not triggered at all, but the value in input is changed.
  2. When selecting a portion of the text using shift+arrow keys and then attempting to perform the cut action, it does not execute at all.

Reproducer

https://stackblitz.com/edit/vitejs-vite-i8hwvq?file=src%2FApp.tsx

PrimeReact version

10.3.3

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Put some value in the InputNumber
  2. Select text
  3. Perform cut action using Ctrl + X

Expected behavior

Events should be triggered correctly

KubaGorka avatar Feb 27 '24 14:02 KubaGorka

I think this will be fixed if InputNumber switches from onKeyPress to onKeyUp. There is an open PrimeVue ticket about it I have been monitoring: https://github.com/primefaces/primevue/issues/5008

melloware avatar Feb 27 '24 16:02 melloware