Cannot produce element right-click in react testing-library user-event v14

1.1k Views Asked by At

I'm using react-contextmenu and I was able to trigger contextmenu in v13 by following

userEvent.click(node, { button: 2 });

but after upgrading v14 I'm not able to trigger contextmenu or right-click event of an element

Tried fireEvent.contextMenu(node) and various ways but didn't work.

1

There are 1 best solutions below

0
adsy On BEST ANSWER

Bit of a longshot but try changing to the newer API:

  userEventuser.pointer({ keys: '[MouseRight>]', target: node })