From 7ab20f09ccc0095872bac31d6cb815d962c520dc Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 3 Jul 2017 17:19:47 -0700 Subject: [PATCH] Fix focus issues with identity key send view Tabbing right after entering the view would cause everythign to go crazy as focus went back to the pane you were just on. This change both sets the proper focus on load of that view (on the cancel button) and hides other panes when they aren't active, only making them visible again when they are once again the 'top' pane. FREEBIE --- js/views/conversation_view.js | 6 ++++++ js/views/message_detail_view.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index f25dc9416..1caafe161 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -638,6 +638,9 @@ listenBack: function(view) { this.panels = this.panels || []; + if (this.panels.length > 0) { + this.panels[0].$el.hide(); + } this.panels.unshift(view); if (this.panels.length === 1) { @@ -649,6 +652,9 @@ }, resetPanel: function() { var view = this.panels.shift(); + if (this.panels.length > 0) { + this.panels[0].$el.show(); + } view.remove(); if (this.panels.length === 0) { diff --git a/js/views/message_detail_view.js b/js/views/message_detail_view.js index fccc19f30..1a2af6f98 100644 --- a/js/views/message_detail_view.js +++ b/js/views/message_detail_view.js @@ -38,9 +38,10 @@ this.listenTo(view, 'send-anyway', this.onSendAnyway); view.render(); + this.listenBack(view); + view.$('.cancel').focus(); } - // TODO: is there anything we might want to do here? Pop a confirmation dialog? Ideally it would always have error-specific help. }, forceSend: function() { this.model.updateVerified().then(function() {