mirror of
https://github.com/mjl-/mox.git
synced 2025-01-14 01:06:27 +03:00
webmail: don't switch back focus after autocompleting address
actually, this fix can reduce focus changes for more operations. withStatus is often used to show an operation in progress in the status bar, only when the operation isn't done within 1 second. we would restore focus to the element before the operation started. that was done because we disable elements sometimes (preventing duplicate form submission). for things like the autocomplete, with the tab key, which also moves focus to the next element, we don't want that focus switched back again.
This commit is contained in:
parent
63c3c1fd6a
commit
79f91ebd87
2 changed files with 2 additions and 2 deletions
|
@ -1967,7 +1967,7 @@ const withStatus = async (action, promise, disablable, noAlert) => {
|
|||
if (disablable) {
|
||||
disablable.disabled = false;
|
||||
}
|
||||
if (origFocus && document.activeElement !== origFocus && origFocus instanceof HTMLElement) {
|
||||
if (disablable && origFocus && document.activeElement !== origFocus && origFocus instanceof HTMLElement && origFocus.parentNode) {
|
||||
origFocus.focus();
|
||||
}
|
||||
if (id) {
|
||||
|
|
|
@ -902,7 +902,7 @@ const withStatus = async <T>(action: string, promise: Promise<T>, disablable?: D
|
|||
if (disablable) {
|
||||
disablable.disabled = false
|
||||
}
|
||||
if (origFocus && document.activeElement !== origFocus && origFocus instanceof HTMLElement) {
|
||||
if (disablable && origFocus && document.activeElement !== origFocus && origFocus instanceof HTMLElement && origFocus.parentNode) {
|
||||
origFocus.focus()
|
||||
}
|
||||
if (id) {
|
||||
|
|
Loading…
Reference in a new issue