Restrict inbox keyboard shortcuts to mine tab only
All keyboard shortcuts (j/k/a/y/U/r/Enter) now only fire when the user is on the "Mine" tab. Previously j/k and other navigation shortcuts were active on all tabs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
c8956094ad
commit
4426d96610
1 changed files with 4 additions and 3 deletions
|
|
@ -950,11 +950,12 @@ export function Inbox() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Keyboard shortcuts are only active on the "mine" tab
|
||||
if (tab !== "mine") return;
|
||||
|
||||
const itemCount = workItemsToRender.length;
|
||||
if (itemCount === 0) return;
|
||||
|
||||
const isMineTab = tab === "mine";
|
||||
|
||||
switch (e.key) {
|
||||
case "j": {
|
||||
e.preventDefault();
|
||||
|
|
@ -968,7 +969,7 @@ export function Inbox() {
|
|||
}
|
||||
case "a":
|
||||
case "y": {
|
||||
if (!isMineTab || selectedIndex < 0 || selectedIndex >= itemCount) return;
|
||||
if (selectedIndex < 0 || selectedIndex >= itemCount) return;
|
||||
e.preventDefault();
|
||||
const item = workItemsToRender[selectedIndex];
|
||||
const key = getWorkItemKey(item);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue