FIX: Remove up/down key bindings for search results

Up/down key bindings make it difficult to access Show More on search results.
https://meta.discourse.org/t/keyboard-users-cant-select-show-more-in-search-results/19394
This commit is contained in:
cpradio 2014-08-28 19:58:07 -04:00
parent 1acb2a13f1
commit 3e7084743c
1 changed files with 23 additions and 23 deletions

View File

@ -2,28 +2,28 @@ export default Discourse.View.extend({
tagName: 'div', tagName: 'div',
classNames: ['d-dropdown'], classNames: ['d-dropdown'],
elementId: 'search-dropdown', elementId: 'search-dropdown',
templateName: 'search', templateName: 'search'
didInsertElement: function() { // didInsertElement: function() {
// Delegate ESC to the composer // // Delegate ESC to the composer
var controller = this.get('controller'); // var controller = this.get('controller');
return $('body').on('keydown.search', function(e) { // return $('body').on('keydown.search', function(e) {
if ($('#search-dropdown').is(':visible')) { // if ($('#search-dropdown').is(':visible')) {
switch (e.which) { // switch (e.which) {
case 13: // case 13:
controller.select(); // controller.select();
e.preventDefault(); // e.preventDefault();
break; // break;
case 38: // case 38:
controller.moveUp(); // controller.moveUp();
e.preventDefault(); // e.preventDefault();
break; // break;
case 40: // case 40:
controller.moveDown(); // controller.moveDown();
e.preventDefault(); // e.preventDefault();
break; // break;
} // }
} // }
}); // });
} // }
}); });