From 676d379e29f24e3f734fbc44b00dc73884f0d5af Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 15 Nov 2022 14:45:38 +0100 Subject: [PATCH] Resolve #501 --- dev/View/Popup/Compose.js | 17 ++++++----------- .../app/templates/Views/User/PopupsCompose.html | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 06306527d..d36a73729 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -272,15 +272,11 @@ export class ComposePopupView extends AbstractViewPopup { currentIdentity: IdentityUserStore()[0] }); - // this.to.subscribe((v) => console.log(v)); - // Used by ko.bindingHandlers.emailsTags - this.to.focused = ko.observable(false); - this.to.focused.subscribe(value => value && (this.sLastFocusedField = 'to')); - this.cc.focused = ko.observable(false); - this.cc.focused.subscribe(value => value && (this.sLastFocusedField = 'cc')); - this.bcc.focused = ko.observable(false); - this.bcc.focused.subscribe(value => value && (this.sLastFocusedField = 'bcc')); + ['to','cc','bcc'].forEach(name => { + this[name].focused = ko.observable(false); + this[name].focused.subscribe(value => value && (this.sLastFocusedField = name)); + }); this.attachments = koArrayWithDestroy(); @@ -1014,9 +1010,8 @@ export class ComposePopupView extends AbstractViewPopup { setTimeout(() => { if (!this.to()) { this.to.focused(true); - // TODO https://github.com/the-djmaze/snappymail/issues/501#issuecomment-1255906243 -// } else if (!this.subject()) { -// this.subject.focus(); + } else if (!this.subject()) { + this.viewModelDom.querySelector('input[name="subject"]').focus(); } else { this.oEditor?.focus(); } diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html index 84084de4b..acda0b238 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html @@ -124,7 +124,7 @@