diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index ffdb5da7b..d75149c5c 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -31,8 +31,6 @@ class ComposeOpenPgpPopupView extends AbstractViewNext { this.encrypt = ko.observable(false); this.password = ko.observable(''); - this.password.focus = ko.observable(false); - this.buttonFocus = ko.observable(false); this.text = ko.observable(''); this.selectedPrivateKey = ko.observable(null); @@ -296,8 +294,6 @@ class ComposeOpenPgpPopupView extends AbstractViewNext { this.encrypt(false); this.password(''); - this.password.focus(false); - this.buttonFocus(false); this.signKey(null); this.encryptKeys([]); @@ -308,15 +304,11 @@ class ComposeOpenPgpPopupView extends AbstractViewNext { onBuild() { key('tab,shift+tab', KeyState.PopupComposeOpenPGP, () => { - switch (true) { - case this.password.focus(): - this.buttonFocus(true); - break; - case this.buttonFocus(): - this.password.focus(true); - break; - // no default + let btn = this.querySelector('.inputPassword'); + if (btn.matches(':focus')) { + btn = this.querySelector('.buttonDo'); } + btn.focus(); return false; }); } @@ -326,11 +318,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext { } onShowWithDelay() { - if (this.sign()) { - this.password.focus(true); - } else { - this.buttonFocus(true); - } + this.querySelector(this.sign() ? '.inputPassword' : '.buttonDo').focus(); } onShow(fCallback, sText, identity, sTo, sCc, sBcc) { diff --git a/dev/View/Popup/MessageOpenPgp.js b/dev/View/Popup/MessageOpenPgp.js index ea1c847c0..fb12b4f69 100644 --- a/dev/View/Popup/MessageOpenPgp.js +++ b/dev/View/Popup/MessageOpenPgp.js @@ -20,8 +20,6 @@ class MessageOpenPgpPopupView extends AbstractViewNext { this.privateKeys = ko.observableArray([]); this.password = ko.observable(''); - this.password.focus = ko.observable(false); - this.buttonFocus = ko.observable(false); this.resultCallback = null; @@ -72,8 +70,6 @@ class MessageOpenPgpPopupView extends AbstractViewNext { this.notification(''); this.password(''); - this.password.focus(false); - this.buttonFocus(false); this.selectedKey(false); this.submitRequest(false); @@ -84,16 +80,11 @@ class MessageOpenPgpPopupView extends AbstractViewNext { onBuild(oDom) { key('tab,shift+tab', KeyState.PopupMessageOpenPGP, () => { - switch (true) { - case this.password.focus(): - this.buttonFocus(true); - break; - case this.buttonFocus(): - this.password.focus(true); - break; - // no default + let btn = this.querySelector('.inputPassword'); + if (btn.matches(':focus')) { + btn = this.querySelector('.buttonDo'); } - + btn.focus(); return false; }); @@ -114,7 +105,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext { self.selectedKey(ko.dataFor(this)); // eslint-disable-line no-invalid-this - self.password.focus(true); +// this.querySelector('.inputPassword').focus(); }); } @@ -122,11 +113,6 @@ class MessageOpenPgpPopupView extends AbstractViewNext { this.clearPopup(); } - onShowWithDelay() { - this.password.focus(true); - // this.buttonFocus(true); - } - onShow(fCallback, privateKeys) { this.clearPopup(); diff --git a/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html b/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html index 8cedd3648..f6be77342 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html @@ -87,7 +87,7 @@ + data-bind="textInput: password, onEnter: doCommand" />
+