fix: listen to keyup
instead of keypress
for search field activation
The `/` character is entered into the search field after activating it via the `keypress` event. That's unexpected behaviour. This commit fixes that by attaching the keyboard event handler to the `keyup` event.
This commit is contained in:
parent
df84584423
commit
97cdc67c1a
@ -713,10 +713,6 @@ Miniflux.Event = (function() {
|
||||
case 63:
|
||||
Miniflux.Nav.ShowHelp();
|
||||
break;
|
||||
case '/':
|
||||
case 47:
|
||||
Miniflux.Nav.ShowSearch();
|
||||
break;
|
||||
case 'Q':
|
||||
case 81: // Q
|
||||
case 'q':
|
||||
@ -752,6 +748,22 @@ Miniflux.Event = (function() {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
document.onkeyup = function(e) {
|
||||
|
||||
if (isEventIgnored(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Miniflux.Event.lastEventType = "keyboard";
|
||||
|
||||
switch (e.key || e.which) {
|
||||
case '/':
|
||||
case 47:
|
||||
Miniflux.Nav.ShowSearch();
|
||||
break;
|
||||
}
|
||||
};
|
||||
},
|
||||
ListenVisibilityEvents: function() {
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
|
@ -196,10 +196,6 @@ Miniflux.Event = (function() {
|
||||
case 63:
|
||||
Miniflux.Nav.ShowHelp();
|
||||
break;
|
||||
case '/':
|
||||
case 47:
|
||||
Miniflux.Nav.ShowSearch();
|
||||
break;
|
||||
case 'Q':
|
||||
case 81: // Q
|
||||
case 'q':
|
||||
@ -235,6 +231,22 @@ Miniflux.Event = (function() {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
document.onkeyup = function(e) {
|
||||
|
||||
if (isEventIgnored(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Miniflux.Event.lastEventType = "keyboard";
|
||||
|
||||
switch (e.key || e.which) {
|
||||
case '/':
|
||||
case 47:
|
||||
Miniflux.Nav.ShowSearch();
|
||||
break;
|
||||
}
|
||||
};
|
||||
},
|
||||
ListenVisibilityEvents: function() {
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user