Scope the keyboard shortcuts in Catch-up
This commit is contained in:
parent
fef033b282
commit
2e28c147b9
1 changed files with 10 additions and 5 deletions
|
@ -648,7 +648,7 @@ function Catchup() {
|
||||||
const [showHelp, setShowHelp] = useState(false);
|
const [showHelp, setShowHelp] = useState(false);
|
||||||
|
|
||||||
const itemsSelector = '.catchup-list > li > a';
|
const itemsSelector = '.catchup-list > li > a';
|
||||||
useHotkeys(
|
const jRef = useHotkeys(
|
||||||
'j',
|
'j',
|
||||||
() => {
|
() => {
|
||||||
const activeItem = document.activeElement.closest(itemsSelector);
|
const activeItem = document.activeElement.closest(itemsSelector);
|
||||||
|
@ -692,7 +692,7 @@ function Catchup() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotkeys(
|
const kRef = useHotkeys(
|
||||||
'k',
|
'k',
|
||||||
() => {
|
() => {
|
||||||
const activeItem = document.activeElement.closest(itemsSelector);
|
const activeItem = document.activeElement.closest(itemsSelector);
|
||||||
|
@ -736,7 +736,7 @@ function Catchup() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotkeys(
|
const hlRef = useHotkeys(
|
||||||
'h, l',
|
'h, l',
|
||||||
(_, handler) => {
|
(_, handler) => {
|
||||||
// Go next/prev selectedAuthor in authorCountsList list
|
// Go next/prev selectedAuthor in authorCountsList list
|
||||||
|
@ -757,13 +757,18 @@ function Catchup() {
|
||||||
{
|
{
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
ignoreModifiers: true,
|
ignoreModifiers: true,
|
||||||
enableOnFormTags: true,
|
enableOnFormTags: ['input'],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={scrollableRef}
|
ref={(node) => {
|
||||||
|
scrollableRef.current = node;
|
||||||
|
jRef.current = node;
|
||||||
|
kRef.current = node;
|
||||||
|
hlRef.current = node;
|
||||||
|
}}
|
||||||
id="catchup-page"
|
id="catchup-page"
|
||||||
class="deck-container"
|
class="deck-container"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue