aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc
diff options
context:
space:
mode:
authorgemmaro <gemmaro.dev@gmail.com>2023-07-05 03:39:14 +0000
committergit <svn-admin@ruby-lang.org>2023-07-05 03:39:18 +0000
commit62754503d8ba0307e9f8581a5d1bf5b76f6437ae (patch)
treecd9cb31b982c6c2edc9823b0425227d0f74fd1fe /lib/rdoc
parent77fa4787bd26b5193a5cc72226c1a3469f91ba11 (diff)
downloadruby-62754503d8ba0307e9f8581a5d1bf5b76f6437ae.tar.gz
[ruby/rdoc] [DOC] Fix to use KeyboardEvent.key over keyCode
https://github.com/ruby/rdoc/commit/663edc807c
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js6
-rw-r--r--lib/rdoc/generator/template/json_index/js/navigation.js16
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js
index 58e52afecf..d3cded1d57 100644
--- a/lib/rdoc/generator/template/darkfish/js/search.js
+++ b/lib/rdoc/generator/template/darkfish/js/search.js
@@ -15,9 +15,9 @@ Search.prototype = Object.assign({}, Navigation, new function() {
this.init = function() {
var _this = this;
var observer = function(e) {
- switch(e.keyCode) {
- case 38: // Event.KEY_UP
- case 40: // Event.KEY_DOWN
+ switch(e.key) {
+ case 'ArrowUp':
+ case 'ArrowDown':
return;
}
_this.search(_this.input.value);
diff --git a/lib/rdoc/generator/template/json_index/js/navigation.js b/lib/rdoc/generator/template/json_index/js/navigation.js
index dfad74b1ae..137e3a0038 100644
--- a/lib/rdoc/generator/template/json_index/js/navigation.js
+++ b/lib/rdoc/generator/template/json_index/js/navigation.js
@@ -23,24 +23,24 @@ Navigation = new function() {
this.onkeydown = function(e) {
if (!this.navigationActive) return;
- switch(e.keyCode) {
- case 37: //Event.KEY_LEFT:
+ switch(e.key) {
+ case 'ArrowLeft':
if (this.moveLeft()) e.preventDefault();
break;
- case 38: //Event.KEY_UP:
- if (e.keyCode == 38 || e.ctrlKey) {
+ case 'ArrowUp':
+ if (e.key == 'ArrowUp' || e.ctrlKey) {
if (this.moveUp()) e.preventDefault();
}
break;
- case 39: //Event.KEY_RIGHT:
+ case 'ArrowRight':
if (this.moveRight()) e.preventDefault();
break;
- case 40: //Event.KEY_DOWN:
- if (e.keyCode == 40 || e.ctrlKey) {
+ case 'ArrowDown':
+ if (e.key == 'ArrowDown' || e.ctrlKey) {
if (this.moveDown()) e.preventDefault();
}
break;
- case 13: //Event.KEY_RETURN:
+ case 'Enter':
if (this.current) e.preventDefault();
this.select(this.current);
break;