mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
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:
parent
e59f894a94
commit
056b571fb6
2 changed files with 4 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue