noVNC
noVNC copied to clipboard
The System steals keyboard events for certain system keyboard shortcuts, e.g. Cmd+Shift+4
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
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 https://github.com/TigerVNC/tigervnc/commit/4f6d4895c3420e5ac301a916bced4a0065a19183
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?
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
I found similar issues attempted fix by KasmVNC's fork of noVNC will test this solution. https://github.com/kasmtech/noVNC/commit/2b7e3321ae81cff99510738c2ecee1bcd2853d9b
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.
Raised bug to chromium https://bugs.chromium.org/p/chromium/issues/detail?id=1474894#c3
Many thanks. I don't suppose you could also inform Firefox and Safari (WebKit) of this issue?
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
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.
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 ?
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.