[IMP] base: properly focus search input in settings
Before this commit, the search input was focused everytime the settings view was rendered after a timeout of 0. This is not considered as correct. It is fragile as asynchronous code could break in many situations. This commit fixes that behavior by using a hook 'on_attach_callback' which is called when the widget is put in the DOM. This commit is linked to task ID 47221 and PR #26483.
This commit is contained in:
committed by
Thibault Delavallée
parent
9c277c6b6d
commit
f81f85eba2
@@ -32,6 +32,15 @@ var BaseSettingRenderer = FormRenderer.extend({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
on_attach_callback: function () {
|
||||
this._super.apply(this, arguments);
|
||||
// set default focus on searchInput
|
||||
this.searchInput.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* initialize modules list.
|
||||
* remove module that restricted in groups
|
||||
@@ -213,6 +222,7 @@ var BaseSettingRenderer = FormRenderer.extend({
|
||||
},
|
||||
|
||||
_onSettingTabClick: function (event) {
|
||||
this.searchInput.focus();
|
||||
if (this.searchText.length > 0) {
|
||||
this.searchInput.val('');
|
||||
this.searchText = "";
|
||||
@@ -341,6 +351,7 @@ var BaseSettingRenderer = FormRenderer.extend({
|
||||
var BaseSettingController = FormController.extend({
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.disableAutofocus = true;
|
||||
this.renderer.activeSettingTab = this.initialState.context.module;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user