react-datasheet-grid
react-datasheet-grid copied to clipboard
Wrong behaviour when showing Context Menu
Hey, I'm currently facing an issue with context menu which I'm not able to find the reason or solution. I hope you are able to give me some lights on this issue.
Behaviour
When I click anywhere in the spreadsheet for the first time, the browser's context menu appears. Following clicks show the Spreadsheet's context menu correctly.

Expected behaviour Show Spreadsheet context menu every time the user right clicks anywhere in the spreadsheet.
Browser It seems to happen with Edge and Chrome
Operating system Windows 11 Enterprise
Hey @lbozzo , I cannot reproduce the issue (Mac OS, multiple browsers), so I am assuming it is a windows thing? Is the window in focus when you first right-click?
Hey @nick-keller , I managed to replicate it consistently. Yes, it seems to happen only on Windows and it happens when the cursor is moved right after the right-click. It's more common for example with a trackpad, as it is normal to move the fingers a bit after clicking.
I might be wrong, but I created a sandbox with a normal div and I used both event.preventDefault() and event.stopImmediatePropagation() with the idea of blocking any other listeners (and maybe even the browser) of that same event and it seemed to work.
Hey @lbozzo can you help me please. I know this isn't the place to ask for help but I will really appreciate your kind response. Those images you shared, I can see you used select many times. Can you please explain how you did that or share code snippet ? I have followed there documentation https://react-datasheet-grid.netlify.app/docs/examples/implementing-select but I got stuck because there final version was missing something. I am also creating similar app like yours.
@zaryabdev sure, I would like to help you but I'm not able to share code snippets as this is confidential. We might discuss it outside this thread or in the Discussion section.