mirror of
https://git.proxmox.com/git/mirror_novnc
synced 2025-07-17 17:39:16 +00:00
Block user interaction when fallback error shows
When this error is shown, something has gone very wrong. It shows when a bug in the JavaScript causes an uncaught error. In these scenarios we dont want the user to be able to interact with the GUI or the remote session, since we can't guarantee that things work.
This commit is contained in:
parent
58dfb7df45
commit
e1f8232bc9
@ -50,6 +50,16 @@ function handleError(event, err) {
|
||||
|
||||
document.getElementById('noVNC_fallback_error')
|
||||
.classList.add("noVNC_open");
|
||||
|
||||
// Remove focus from the currently focused element in order to
|
||||
// prevent keyboard interaction from continuing
|
||||
document.activeElement.blur();
|
||||
|
||||
// Don't let any element be focusable when showing the error
|
||||
let keyboardFocusable = 'a[href], button, input, textarea, select, details, [tabindex]';
|
||||
document.querySelectorAll(keyboardFocusable).forEach((elem) => {
|
||||
elem.setAttribute("tabindex", "-1");
|
||||
});
|
||||
} catch (exc) {
|
||||
document.write("noVNC encountered an error.");
|
||||
}
|
||||
|
@ -287,6 +287,10 @@ select:active {
|
||||
#noVNC_fallback_error {
|
||||
z-index: 1000;
|
||||
visibility: hidden;
|
||||
/* Put a white background in front of everything but the error,
|
||||
and don't let mouse events pass through */
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
pointer-events: all;
|
||||
}
|
||||
#noVNC_fallback_error.noVNC_open {
|
||||
visibility: visible;
|
||||
|
Loading…
Reference in New Issue
Block a user