diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js
index 3170a21f090..6b19db16a46 100644
--- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js
+++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js
@@ -44,6 +44,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
FUNCTION_BINDINGS: {
'home': 'goToFirstPost',
+ '#': 'toggleProgress',
'end': 'goToLastPost',
'j': 'selectDown',
'k': 'selectUp',
@@ -132,6 +133,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
}
},
+ toggleProgress: function() {
+ Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion');
+ },
+
showSearch: function() {
$('#search-button').click();
return false;
diff --git a/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars b/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars
index b2e64bdddbf..1d10cb1a1f5 100644
--- a/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars
@@ -14,6 +14,7 @@
{{i18n keyboard_shortcuts_help.navigation.title}}
- {{{i18n keyboard_shortcuts_help.navigation.back}}}
+ - {{{i18n keyboard_shortcuts_help.navigation.jump}}}
- {{{i18n keyboard_shortcuts_help.navigation.up_down}}}
- {{{i18n keyboard_shortcuts_help.navigation.open}}}
- {{{i18n keyboard_shortcuts_help.navigation.next_prev}}}
diff --git a/app/assets/javascripts/discourse/views/topic-progress.js.es6 b/app/assets/javascripts/discourse/views/topic-progress.js.es6
index 2e6492ef6cc..ef218c82dc3 100644
--- a/app/assets/javascripts/discourse/views/topic-progress.js.es6
+++ b/app/assets/javascripts/discourse/views/topic-progress.js.es6
@@ -76,10 +76,30 @@ export default Ember.View.extend({
this.set('docked', isDocked);
},
+ _focusWhenOpened: function() {
+ if (this.get('controller.expanded')) {
+ var self = this;
+ Em.run.schedule('afterRender', function() {
+ self.$('input').focus();
+ });
+ }
+ }.observes('controller.expanded'),
+
click: function(e) {
if ($(e.target).parents('#topic-progress').length) {
this.get('controller').send('toggleExpansion');
}
+ },
+
+ keyDown: function(e) {
+ var controller = this.get('controller');
+ if (controller.get('expanded')) {
+ if (e.keyCode === 13) {
+ controller.send('jumpPost');
+ } else if (e.keyCode === 27) {
+ controller.send('toggleExpansion');
+ }
+ }
}
});
diff --git a/app/assets/stylesheets/common/components/keyboard_shortcuts.css.scss b/app/assets/stylesheets/common/components/keyboard_shortcuts.css.scss
index 7825a799b5d..69010950929 100644
--- a/app/assets/stylesheets/common/components/keyboard_shortcuts.css.scss
+++ b/app/assets/stylesheets/common/components/keyboard_shortcuts.css.scss
@@ -11,7 +11,7 @@
}
.keyboard-shortcuts-modal .modal-body {
- max-height: 500px;
+ max-height: 520px;
}
#keyboard-shortcuts-help {
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 792e28bf27f..7a847911444 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1850,6 +1850,7 @@ en:
categories: 'g then c Categories'
navigation:
title: 'Navigation'
+ jump: '# Go to post number'
back: 'u Back'
up_down: 'k/j Move selection up/down'
open: 'o or Enter Open selected topic'