diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index 473f9d14e..9107c141a 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -36,8 +36,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ 'm t': 'div.notification-options li[data-id="2"] a', // mark topic as tracking 'm w': 'div.notification-options li[data-id="3"] a', // mark topic as watching 'n': '#user-notifications', // open notifications menu - '=': '#site-map', // open site map menu - 'p': '#current-user', // open current user menu 'o,enter': '.topic-list tr.selected a.title', // open selected topic 'shift+r': '#topic-footer-buttons button.create', // reply to topic 'shift+s': '#topic-footer-buttons button.share', // share topic @@ -54,6 +52,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ '`': 'nextSection', '~': 'prevSection', '/': 'showSearch', + '=': 'showSiteMap', // open site map menu + 'p': 'showCurrentUser', // open current user menu 'ctrl+f': 'showBuiltinSearch', 'command+f': 'showBuiltinSearch', '?': 'showHelpModal', // open keyboard shortcut help @@ -145,6 +145,16 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ return false; }, + showSiteMap: function() { + $('#site-map').click(); + $('#site-map-dropdown').focus(); + }, + + showCurrentUser: function() { + $('#current-user').click(); + $('#user-dropdown').focus(); + }, + showHelpModal: function() { Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp'); }, diff --git a/app/assets/javascripts/discourse/views/header.js.es6 b/app/assets/javascripts/discourse/views/header.js.es6 index 0986709a5..c6e7e3013 100644 --- a/app/assets/javascripts/discourse/views/header.js.es6 +++ b/app/assets/javascripts/discourse/views/header.js.es6 @@ -58,7 +58,7 @@ export default Discourse.View.extend({ // fade it fast $dropdown.fadeIn('fast'); // autofocus any text input field - $dropdown.find('input[type=text],a:first').focus().select(); + $dropdown.find('input[type=text]').focus().select(); $html.on('click.d-dropdown', function(e) { return $(e.target).closest('.d-dropdown').length > 0 ? true : hideDropdown.apply(self);