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
This commit is contained in:
Scott Nonnenberg 2017-07-03 17:19:47 -07:00
parent ff4fde651c
commit 7ab20f09cc
2 changed files with 8 additions and 1 deletions

View file

@ -638,6 +638,9 @@
listenBack: function(view) { listenBack: function(view) {
this.panels = this.panels || []; this.panels = this.panels || [];
if (this.panels.length > 0) {
this.panels[0].$el.hide();
}
this.panels.unshift(view); this.panels.unshift(view);
if (this.panels.length === 1) { if (this.panels.length === 1) {
@ -649,6 +652,9 @@
}, },
resetPanel: function() { resetPanel: function() {
var view = this.panels.shift(); var view = this.panels.shift();
if (this.panels.length > 0) {
this.panels[0].$el.show();
}
view.remove(); view.remove();
if (this.panels.length === 0) { if (this.panels.length === 0) {

View file

@ -38,9 +38,10 @@
this.listenTo(view, 'send-anyway', this.onSendAnyway); this.listenTo(view, 'send-anyway', this.onSendAnyway);
view.render(); view.render();
this.listenBack(view); 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() { forceSend: function() {
this.model.updateVerified().then(function() { this.model.updateVerified().then(function() {