Deal with lost focus when selection cleared

This was missed out of the work on improving focus
on the templates page.

When you clear the current selection, the 'clear'
link disappears so focus needs to be sent
somewhere.
This commit is contained in:
Tom Byers
2019-02-13 16:43:38 +00:00
parent 60b69bc0b5
commit a8cac953d7

View File

@@ -35,7 +35,7 @@
// first off show the new template / new folder buttons
this.currentState = this.$form.data('prev-state') || 'unknown';
if (this.currentState === 'unknown') {
this.selectActionButtons(false);
this.selectActionButtons();
} else {
this.render();
}
@@ -90,13 +90,14 @@
};
this.addClearButton = function(state) {
let selector = 'button[value=add-new-template]';
let $clear = this.makeButton('Clear', () => {
// uncheck all templates and folders
this.$form.find('input:checkbox').prop('checked', false);
// go back to action buttons
this.selectActionButtons();
this.selectActionButtons(selector);
});
state.$el.find('.template-list-selected-counter').append($clear);