Removed: KnockoutJS 'hasFocus:' because HTML5 has autofocus=""

Knoin.js now searches for [autofocus] and handles it
This commit is contained in:
djmaze 2020-08-22 01:03:03 +02:00
parent 226f77e392
commit 996723a486
18 changed files with 60 additions and 113 deletions

View file

@ -16,7 +16,6 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
super();
this.key = ko.observable('');
this.key.focus = ko.observable(false);
this.key.error = ko.observable(false);
this.key.errorMessage = ko.observable('');
@ -95,10 +94,6 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
onShow() {
this.clearPopup();
}
onShowWithDelay() {
this.key.focus(true);
}
}
export { AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default };

View file

@ -18,9 +18,6 @@ class AskPopupView extends AbstractViewNext {
this.yesButton = ko.observable('');
this.noButton = ko.observable('');
this.yesFocus = ko.observable(false);
this.noFocus = ko.observable(false);
this.fYesAction = null;
this.fNoAction = null;
@ -34,9 +31,6 @@ class AskPopupView extends AbstractViewNext {
this.yesButton(i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(i18n('POPUPS_ASK/BUTTON_NO'));
this.yesFocus(false);
this.noFocus(false);
this.fYesAction = null;
this.fNoAction = null;
}
@ -87,17 +81,17 @@ class AskPopupView extends AbstractViewNext {
onShowWithDelay() {
if (this.bFocusYesOnShow) {
this.yesFocus(true);
this.querySelector('.buttonYes').focus();
}
}
onBuild() {
key('tab, shift+tab, right, left', KeyState.PopupAsk, () => {
if (this.yesFocus()) {
this.noFocus(true);
} else {
this.yesFocus(true);
let btn = this.querySelector('.buttonYes');
if (btn.matches(':focus')) {
btn = this.querySelector('.buttonNo');
}
btn.focus();
return false;
});

View file

@ -61,7 +61,6 @@ class DomainPopupView extends AbstractViewNext {
this.smtpServerFocus = ko.observable(false);
this.name = ko.observable('');
this.name.focused = ko.observable(false);
this.imapServer = ko.observable('');
this.imapPort = ko.observable('' + IMAP_DEFAULT_PORT);
@ -379,12 +378,6 @@ class DomainPopupView extends AbstractViewNext {
}
}
onShowWithDelay() {
if (!this.name() && !bMobileDevice) {
this.name.focused(true);
}
}
clearForm() {
this.edit(false);
@ -396,7 +389,6 @@ class DomainPopupView extends AbstractViewNext {
this.savingError('');
this.name('');
this.name.focused(false);
this.imapServer('');
this.imapPort('' + IMAP_DEFAULT_PORT);

View file

@ -25,7 +25,6 @@ class DomainAliasPopupView extends AbstractViewNext {
this.savingError = ko.observable('');
this.name = ko.observable('');
this.name.focused = ko.observable(false);
this.alias = ko.observable('');
@ -64,18 +63,11 @@ class DomainAliasPopupView extends AbstractViewNext {
this.clearForm();
}
onShowWithDelay() {
if (!this.name() && !bMobileDevice) {
this.name.focused(true);
}
}
clearForm() {
this.saving(false);
this.savingError('');
this.name('');
this.name.focused(false);
this.alias('');
}

View file

@ -27,7 +27,6 @@ class IdentityPopupView extends AbstractViewNext {
this.email = ko.observable('').validateEmail();
this.email.focused = ko.observable(false);
this.name = ko.observable('');
this.name.focused = ko.observable(false);
this.replyTo = ko.observable('').validateSimpleEmail();
this.replyTo.focused = ko.observable(false);
this.bcc = ko.observable('').validateSimpleEmail();

View file

@ -14,13 +14,10 @@ class WelcomePagePopupView extends AbstractViewNext {
super();
this.welcomePageURL = ko.observable('');
this.closeFocused = ko.observable(false);
}
clearPopup() {
this.welcomePageURL('');
this.closeFocused(false);
}
/**
@ -33,10 +30,6 @@ class WelcomePagePopupView extends AbstractViewNext {
this.welcomePageURL(sUrl);
}
onShowWithDelay() {
this.closeFocused(true);
}
onHide() {
Promises.welcomeClose();
}