webmail: don't consume keyboard events while login form is open

e.g. ctrl-l, for going to address bar to go to another site.
This commit is contained in:
Mechiel Lukkien 2024-12-06 14:57:20 +01:00
parent e59f894a94
commit 056b571fb6
No known key found for this signature in database
2 changed files with 4 additions and 0 deletions

View file

@ -1679,6 +1679,7 @@ let rejectsMailbox = '';
// Last known server version. For asking to reload.
let lastServerVersion = '';
const login = async (reason) => {
popupOpen = true; // Prevent global key event handler from consuming keys.
return new Promise((resolve, _) => {
const origFocus = document.activeElement;
let reasonElem;
@ -1716,6 +1717,7 @@ const login = async (reason) => {
if (origFocus && origFocus instanceof HTMLElement && origFocus.parentNode) {
origFocus.focus();
}
popupOpen = false;
resolve(token);
}
catch (err) {

View file

@ -262,6 +262,7 @@ let rejectsMailbox: string = ''
let lastServerVersion: string = ''
const login = async (reason: string) => {
popupOpen = true // Prevent global key event handler from consuming keys.
return new Promise<string>((resolve: (v: string) => void, _) => {
const origFocus = document.activeElement
let reasonElem: HTMLElement
@ -308,6 +309,7 @@ const login = async (reason: string) => {
if (origFocus && origFocus instanceof HTMLElement && origFocus.parentNode) {
origFocus.focus()
}
popupOpen = false
resolve(token)
} catch (err) {
console.log('login error', err)