mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #4166 from dmitrylyzo/fix-input-navigation
This commit is contained in:
commit
4f3ac34739
1 changed files with 15 additions and 2 deletions
|
@ -44,6 +44,11 @@ const KeyNames = {
|
|||
*/
|
||||
const NavigationKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
|
||||
/**
|
||||
* Elements for which navigation should be constrained.
|
||||
*/
|
||||
const InteractiveElements = ['INPUT', 'TEXTAREA'];
|
||||
|
||||
let hasFieldKey = false;
|
||||
try {
|
||||
hasFieldKey = 'key' in new KeyboardEvent('keydown');
|
||||
|
@ -91,13 +96,21 @@ export function enable() {
|
|||
|
||||
switch (key) {
|
||||
case 'ArrowLeft':
|
||||
inputManager.handleCommand('left');
|
||||
if (!InteractiveElements.includes(document.activeElement?.tagName)) {
|
||||
inputManager.handleCommand('left');
|
||||
} else {
|
||||
capture = false;
|
||||
}
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
inputManager.handleCommand('up');
|
||||
break;
|
||||
case 'ArrowRight':
|
||||
inputManager.handleCommand('right');
|
||||
if (!InteractiveElements.includes(document.activeElement?.tagName)) {
|
||||
inputManager.handleCommand('right');
|
||||
} else {
|
||||
capture = false;
|
||||
}
|
||||
break;
|
||||
case 'ArrowDown':
|
||||
inputManager.handleCommand('down');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue