diff options
Diffstat (limited to 'addons/web/static/src/js/chrome')
| -rw-r--r-- | addons/web/static/src/js/chrome/action_manager_act_window.js | 16 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome/search_view.js | 15 |
2 files changed, 31 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js index 8ac11f60537..9dc0ff4c1c8 100644 --- a/addons/web/static/src/js/chrome/action_manager_act_window.js +++ b/addons/web/static/src/js/chrome/action_manager_act_window.js @@ -25,6 +25,7 @@ ActionManager.include({ update_filters: '_onUpdateFilters', search: '_onSearch', switch_view: '_onSwitchView', + navigation_move: '_onNavigationMove', }), //-------------------------------------------------------------------------- @@ -821,6 +822,21 @@ ActionManager.include({ data.callback(addedFilters); }, /** + * Called mainly from the control panel when the focus should be given to a controller + * + * @param {OdooEvent} event + * @private + */ + _onNavigationMove : function(event) { + switch(event.data.direction) { + case 'down' : + var currentController = this.getCurrentController().widget; + currentController.giveFocus(); + event.stopPropagation(); + break; + } + }, + /** * Called when there is a change in the search view, so the current action's * environment needs to be updated with the new domain, context and groupby. * diff --git a/addons/web/static/src/js/chrome/search_view.js b/addons/web/static/src/js/chrome/search_view.js index 8ec1eb9ec71..94087c999b6 100644 --- a/addons/web/static/src/js/chrome/search_view.js +++ b/addons/web/static/src/js/chrome/search_view.js @@ -248,6 +248,12 @@ var SearchView = Widget.extend({ } e.preventDefault(); break; + case $.ui.keyCode.DOWN: + if (!this.autocomplete.is_expanded()) { + e.preventDefault(); + this.trigger_up('navigation_move', {direction: 'down'}); + break; + } } }, }, @@ -336,6 +342,9 @@ var SearchView = Widget.extend({ } return $.when.apply($, menu_defs).then(this.set_default_filters.bind(this)); }, + on_attach_callback: function () { + this._focusInput(); + }, get_title: function () { return this.title; }, @@ -417,6 +426,12 @@ var SearchView = Widget.extend({ if (this.$buttons) { this.$buttons.toggle(!this.headless && is_visible && this.visible_filters); } + this._focusInput(); + }, + /** + * puts the focus on the search input + */ + _focusInput: function () { if (!config.device.touch && config.device.size_class >= config.device.SIZES.SM) { this.$('input').focus(); } |
