Skip to content

Commit

Permalink
focus behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Feb 16, 2024
1 parent 0c25314 commit 55a7c6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,13 @@ export function dealWithFocusEvent(
focusedItems: number[]
) {
const newFocusedItems = toggleElement(focusedItems, clickedItem);
const isShift = e.shiftKey;
const isCtrl = e.ctrlKey;
if (isShift) {
if (e.shiftKey || e.ctrlKey || e.metaKey) {
return newFocusedItems;
}
if (isCtrl) {
return newFocusedItems;
const itemInFocus = newFocusedItems.includes(clickedItem);
const numFocused = focusedItems.length;
if (numFocused > 1) {
return [clickedItem];
}
return [clickedItem];
return itemInFocus ? [clickedItem] : [];
}

0 comments on commit 55a7c6e

Please sign in to comment.