Skip to content

Commit

Permalink
fix: [BUG] - Autocomplete - Text selection with Shift + Home/End isn'…
Browse files Browse the repository at this point in the history
…t working (#7228)

Possible fix for #7228
  • Loading branch information
majornista committed Nov 19, 2024
1 parent 52e167d commit 84b820b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/@react-aria/selection/src/useSelectableCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
}
case 'Home':
if (delegate.getFirstKey) {
if (manager.focusedKey === null && e.shiftKey) {
return;
}
e.preventDefault();
let firstKey: Key | null = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));
manager.setFocusedKey(firstKey);
Expand All @@ -236,6 +239,9 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
break;
case 'End':
if (delegate.getLastKey) {
if (manager.focusedKey === null && e.shiftKey) {
return;
}
e.preventDefault();
let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));
manager.setFocusedKey(lastKey);
Expand Down

0 comments on commit 84b820b

Please sign in to comment.