Add option to focus a treelist widget on clicks to the container (#1489997)
| | |
| | | this.treelist = new rcube_treelist_widget(this.gui_objects.folderlist, { |
| | | selectable: true, |
| | | id_prefix: 'rcmli', |
| | | parent_focus: true, |
| | | id_encode: this.html_identifier_encode, |
| | | id_decode: this.html_identifier_decode, |
| | | check_droptarget: function(node) { return !node.virtual && ref.check_droptarget(node.id) } |
| | |
| | | this.subscription_list = new rcube_treelist_widget(this.gui_objects.subscriptionlist, { |
| | | selectable: true, |
| | | tabexit: false, |
| | | parent_focus: true, |
| | | id_prefix: 'rcmli', |
| | | id_encode: this.html_identifier_encode, |
| | | id_decode: this.html_identifier_decode, |
| | |
| | | save_state: false, |
| | | keyboard: true, |
| | | tabexit: true, |
| | | parent_focus: false, |
| | | check_droptarget: function(node) { return !node.virtual; } |
| | | }, p || {}); |
| | | |
| | |
| | | $(document.body) |
| | | .bind('keydown', keypress); |
| | | |
| | | // catch focus when clicking the list container area |
| | | if (p.parent_focus) { |
| | | container.parent(':not(body)').click(function(e) { |
| | | if (!has_focus && selection) { |
| | | $(get_item(selection)).find(':focusable').first().focus(); |
| | | } |
| | | else if (!has_focus) { |
| | | container.children('li:has(:focusable)').first().find(':focusable').first().focus(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /////// private methods |
| | | |