Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The System steals keyboard events for certain system keyboard shortcuts, e.g. Cmd+Shift+4 #1799

Open
namper opened this issue Aug 17, 2023 · 13 comments

Comments

@namper
Copy link

namper commented Aug 17, 2023

Describe the bug
The system steals keyboard events for certain system keyboard shortcuts, e.g. Cmd+Shift+4. Unfortunately, this isn't considered a focus loss, so the server doesn't realize it has lost a few keyboard events and can end up in a confused state.

To Reproduce
Steps to reproduce the behavior:
Press CMD+SHIFT+4
Take screenshot
Click on server and see that server is confused as you can't click but can only drag.

Expected behavior
noVNC should catch focus loss and reset keyboard state.

Screenshots
cced1247-88f4-4ddf-945b-1c314fb2ba51

Client (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Browser version: 115.0.5790.170

Server (please complete the following information):

  • noVNC version: 1.4.0
  • VNC server: TigerVNC
  • WebSocket proxy: websockify

Additional context
Here is this exact problem solved by tigervnc TigerVNC/tigervnc@4f6d489

@CendioOssman
Copy link
Member

Unfortunately, we don't have access to the low-level events like TigerVNC has, so we can't apply the same workaround.

Likely this needs to be fixed in the browsers so that they send keyup events when this happens.

Have you reported the issue to the different browsers?

@namper
Copy link
Author

namper commented Aug 21, 2023

Thanks for reply. I am aware we can't access the low level API hack that TigerVNC is doing. Unfortunately, this bug is also reproducible on Safari & Mozilla. What would you advise as potential interim solution, for example detecting that Command and Shift is pressed and scheduling Command & Shift key down events to server.

Versions:
Safari: 16.5
Firefox: 107.0.1

@namper
Copy link
Author

namper commented Aug 21, 2023

I found similar issues attempted fix by KasmVNC's fork of noVNC will test this solution. kasmtech@2b7e332

@CendioOssman
Copy link
Member

Trying to perfectly detect every possible troublesome shortcut would be a maintenance nightmare. So what Kasm has done is probably a more feasible mitigation of the issue.

It's important that the issue get reported to all the browsers, though, so a proper solution can be available long term.

@namper
Copy link
Author

namper commented Aug 23, 2023

@CendioOssman
Copy link
Member

Many thanks. I don't suppose you could also inform Firefox and Safari (WebKit) of this issue?

@namper
Copy link
Author

namper commented Aug 29, 2023

Many thanks. I don't suppose you could also inform Firefox and Safari (WebKit) of this issue?

Likewise. Raised to all 3 of them.

WebKit: https://bugs.webkit.org/show_bug.cgi?id=260866
Mozila: https://bugzilla.mozilla.org/show_bug.cgi?id=1850583
Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1474894#c3

@freebrowser1
Copy link

freebrowser1 commented Jun 30, 2024

Weird.
I tried it on Brave (a sanitized Chrome clone, Cr 125) on macOS 14.5 Sonoma and connected to two VNC servers one with noVNC 1.3.0 and the other with 1.5.0, but the screenshot shortcut cmd+shift+4 did work normally and was not swallowed by the browser or noVNC. These servers run TigerVNC.
The same applies to Safari.

@namper
Copy link
Author

namper commented Jun 30, 2024

Weird.

I tried it on Brave (a sanitized Chrome clone, Cr 125) on macOS 14.5 Sonoma and connected to two VNC servers one with noVNC 1.3.0 and the other with 1.5.0, but the screenshot shortcut cmd+shift+4 did work normally and was not swallowed by the browser or noVNC. These servers run TigerVNC.

The same applies to Safari.

Screenshot will work fine but keyup event will be swallowed. What was version of Chrome and Safari that you tried with ?

@freebrowser1
Copy link

Screenshot will work fine but keyup event will be swallowed. What was version of Chrome and Safari that you tried with ?
Chrome (Brave) v.125 and Safari 14 (?) the one supplied with macOS 14.5.

@noREAVER
Copy link

I believe the problem goes much more deeper.
I noticed this issue while trying to use Streamdeck to type some text to noVNC consoles in Proxmox.
noVNC is 1.4.0-0 and has the big problem of not registering anything that's supposed to be a combination with SHIFT key
Anything that's not directly sending hardware keycodes fails.
For example typing with InputStick and xKeys works fine in hardware mode.
But if I type/send text with xKeys/MacroWorks in software mode or Streamdeck, then it fails to type correctly.
BUT noVNC 1.3.0 (i have one installed on a ondemand instance) doesn't have this issue at all.
image

Also the text appears very fast, almost instantly typed on 1.3.0 but much slower and wrong on 1.4.0-4

@CendioOssman
Copy link
Member

The issue discussed here is a macOS specific problem, so I'm afraid that is some other problem.

@noREAVER
Copy link

noREAVER commented Nov 21, 2024

The issue discussed here is a macOS specific problem, so I'm afraid that is some other problem.

The client running the browser is a Mac indeed, the server where noVNC server is running on though ... is not specified so I assume is a linux machine.
You might be right, so I will create another issue i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants