fix: nepřepínání dnů/týdnů při otevřené minihře
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 32s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 2m38s
CI / Build and push Docker image (push) Successful in 45s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 32s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 2m38s
CI / Build and push Docker image (push) Successful in 45s
CI / Notify (push) Successful in 2s
This commit is contained in:
1 parent
95a35df6ab
commit
fe12098ed0
5 files changed
+20
-4
No files matched your search
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Zda se má stisk klávesy ignorovat pro navigaci šipkami mezi dny/týdny na pozadí stránky.
|
||||
* Navigace se nemá provádět, pokud uživatel píše do formulářového pole, nebo pokud je otevřený
|
||||
* modální dialog (typicky minihra jako Tetris či Had, která šipky používá k ovládání) –
|
||||
* jinak by se stránka na pozadí neustále přepínala a zbytečně přenačítala data ze serveru.
|
||||
*/
|
||||
export function isArrowNavigationBlocked(e: KeyboardEvent): boolean {
|
||||
const target = e.target as HTMLElement | null;
|
||||
if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return true;
|
||||
return document.body.classList.contains('modal-open') || document.querySelector('.modal.show') != null;
|
||||
}
|
||||
Reference in new issue
Block a user