Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to use KeyboardEvent.key over keyCode #962

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/rdoc/generator/template/darkfish/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions lib/rdoc/generator/template/json_index/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down