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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keyboard shortcuts are only active on the "mine" tab
|
||||||
|
if (tab !== "mine") return;
|
||||||
|
|
||||||
const itemCount = workItemsToRender.length;
|
const itemCount = workItemsToRender.length;
|
||||||
if (itemCount === 0) return;
|
if (itemCount === 0) return;
|
||||||
|
|
||||||
const isMineTab = tab === "mine";
|
|
||||||
|
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case "j": {
|
case "j": {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
@ -968,7 +969,7 @@ export function Inbox() {
|
||||||
}
|
}
|
||||||
case "a":
|
case "a":
|
||||||
case "y": {
|
case "y": {
|
||||||
if (!isMineTab || selectedIndex < 0 || selectedIndex >= itemCount) return;
|
if (selectedIndex < 0 || selectedIndex >= itemCount) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const item = workItemsToRender[selectedIndex];
|
const item = workItemsToRender[selectedIndex];
|
||||||
const key = getWorkItemKey(item);
|
const key = getWorkItemKey(item);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue