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

View file

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