diff options
author | Christopher Ng <chrng8@gmail.com> | 2023-01-12 01:35:53 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2023-01-13 23:19:28 +0000 |
commit | f6aa5224c4c8a1e9e57f0a8069bd5f70054314e8 (patch) | |
tree | df492c57c99bd6cfeea6d381faf1beb693cad89c /core/src/OC | |
parent | f7ff54860bef10c856542bb17ceb90e824c62dc8 (diff) | |
download | nextcloud-server-f6aa5224c4c8a1e9e57f0a8069bd5f70054314e8.tar.gz nextcloud-server-f6aa5224c4c8a1e9e57f0a8069bd5f70054314e8.zip |
Focus trap contacts menu with NcHeaderMenu port
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core/src/OC')
-rw-r--r-- | core/src/OC/contactsmenu.js | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/core/src/OC/contactsmenu.js b/core/src/OC/contactsmenu.js index 7e1586aeead..b9f4b0fc064 100644 --- a/core/src/OC/contactsmenu.js +++ b/core/src/OC/contactsmenu.js @@ -381,8 +381,7 @@ const ContactsMenuView = View.extend({ /** * @param {Object} options - * @param {jQuery} options.el - * @param {jQuery} options.trigger + * @param {string} options.el * @class ContactsMenu * @memberOf OC */ @@ -391,12 +390,9 @@ const ContactsMenu = function(options) { } ContactsMenu.prototype = { - /** @type {jQuery} */ + /** @type {string} */ $el: undefined, - /** @type {jQuery} */ - _$trigger: undefined, - /** @type {ContactsMenuView} */ _view: undefined, @@ -405,41 +401,19 @@ ContactsMenu.prototype = { /** * @param {Object} options - * @param {jQuery} options.el - the element to render the menu in - * @param {jQuery} options.trigger - the element to click on to open the menu + * @param {string} options.el - the selector of the element to render the menu in * @returns {undefined} */ initialize: function(options) { - this.$el = options.el - this._$trigger = options.trigger + this.$el = $(options.el) this._view = new ContactsMenuView({ - el: this.$el + el: this.$el, }) + this._view.on('search', function(searchTerm) { - this._loadContacts(searchTerm) + this.loadContacts(searchTerm) }, this) - - OC.registerMenu(this._$trigger, this.$el, function() { - this._toggleVisibility(true) - }.bind(this), true) - this.$el.on('beforeHide', function() { - this._toggleVisibility(false) - }.bind(this)) - }, - - /** - * @private - * @param {boolean} show - * @returns {Promise} - */ - _toggleVisibility: function(show) { - if (show) { - return this._loadContacts() - } else { - this.$el.html('') - return Promise.resolve() - } }, /** @@ -461,7 +435,7 @@ ContactsMenu.prototype = { * @param {string|undefined} searchTerm * @returns {undefined} */ - _loadContacts: function(searchTerm) { + loadContacts: function(searchTerm) { var self = this if (!self._contactsPromise) { |