primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Use KeyboardEvent.key instead of the deprecated KeyboardEvent.which and/or KeyboardEvent.keyCode.

Open ankitprahladsoni opened this issue 4 years ago • 5 comments

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

I initially filed a bug with @testing-library/userEvent, but they suggested to move it to PrimeReact. Original issue: testing-library/user-event#684 And the suggested changes where mentioned here https://github.com/testing-library/user-event/issues/684#issuecomment-857498379

Current behavior userEvent.type() doesn't work with InputNumber with decimal inputs

Expected behavior userEvent.type() should work with InputNumber with decimal inputs

Minimal reproduction of the problem with instructions Codesandbox: https://codesandbox.io/s/gallant-ishizaka-hv4n7?file=/src/aaa.test.js

Please tell us about your environment: Any

  • **React version:**17.0.0

  • PrimeReact version: 6.3.2

  • Browser: All

  • Language: All

ankitprahladsoni avatar Jun 09 '21 20:06 ankitprahladsoni

Hello Ankit,

I think the reason why your test case fails is due to the decimal separator in InputNumber being "," (comma) and not "." When I ran your test case with "18,27", the test passes.

Kind regards

DorukKantarcioglu avatar Jun 29 '21 07:06 DorukKantarcioglu

I don't think I have provided the decimal separator as ,. Moreover, the locale locale="en-IN" should not use a decimal separator as a comma anyway. The test case on the test tabs still shows a failed test image

ankitprahladsoni avatar Jun 29 '21 07:06 ankitprahladsoni

image

What I meant was to change the dot to a comma in the test variable

DorukKantarcioglu avatar Jun 29 '21 07:06 DorukKantarcioglu

Should this be closed since it was basically an invalid test?

Also PrimeReact can't drop keyCode or which as it still supports IE11 and IE does not fully support key. See: https://stackoverflow.com/a/4471635/502366

melloware avatar Nov 23 '21 19:11 melloware

I think now that IE is dead this ticket should be implemented.

Here is a great Keyboard event viewer: https://w3c.github.io/uievents/tools/key-event-viewer.html

Also its universally supported now: https://caniuse.com/?search=event.key

melloware avatar Jul 24 '22 11:07 melloware

Issue tracker is used for defects only as part of our commitment to quality and continuous improvement in all areas. Enhancements are collected as valuable community feedback and managed internally so moving this enhancement ticket to our internal project management backlog.

habubey avatar Oct 30 '23 11:10 habubey