xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

Native shift + right click on non-canvas makes shift stuck for the viewer

Open NiklasPor opened this issue 2 months ago • 0 comments

Describe the bug When you right-click outside of the canvas with xeokit while pressing the shift, the browser context menu will open. Once you're going back into the canvas, all controls will behave like shift is still pressed, even though you let go of it while pressing the context menu.

Fix: In the following code, keyboard button status is only updated if keyup is fired. keyup never fires, if the users hits shift and then opens the context menu via right click (then the contextmenu event fires).

https://github.com/xeokit/xeokit-sdk/blob/e9c8daf6ebcecfdbaf9027beea2810fe6e102f22/src/viewer/scene/input/Input.js#L1067-L1082

To Reproduce

  1. Go to https://jsfiddle.net/o6Lzvu58/2/
  2. Click on shift + right click in the right area to open the context menu
  3. Let go of shift
  4. Close the context menu
  5. Now the viewer still behaves like shift is pressed
  6. Once you hit shift again on your keyboard everything will work again

https://github.com/user-attachments/assets/253b9826-c830-4082-8eb3-13da7dc396db

Desktop (please complete the following information):

  • MacOS
  • Chrome

NiklasPor avatar Nov 05 '25 11:11 NiklasPor