-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Select on initial focus #2026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select on initial focus #2026
Conversation
|
Build successful! 🎉 |
| manager.setFocused(true); | ||
|
|
||
| if (manager.focusedKey == null) { | ||
| let navigateToFirstKey = (key: Key | undefined, childFocus?: FocusStrategy) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the childFocus bit prep for grid cases w/ focusable children? Just trying to figure out if useSelectableCollection will have access to childFocus information in onFocus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this function is actually stolen from above https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/selection/src/useSelectableCollection.ts#L114
it's a bit of copy pasta that i forgot about because lint didn't yell at me, it seems as though childFocus is only for arrow keys, so I'm thinking we don't need to worry about it at all
# Conflicts: # packages/@react-aria/selection/test/useSelectableCollection.test.js
|
Build successful! 🎉 |
|
Would be nice to have a better PR title and maybe a description for this so I don't need to go to the original bug to find out what this is. 😉 |
ktabors
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# Conflicts: # packages/@react-aria/selection/test/useSelectableCollection.test.js
…tView (#2363) * Followup to selectOnFocus add demo stories fix clicking without shift * add selectionBehavior * Add story for useSelectableList * update default * cleanup stories * remove extraneous dependency * support keyboard navigation without replacing the selection in select on focus mode * fix lint * Touch multiselect always use toggle (#2046) * Mobile updates for selection * Move mobile awareness to the component * fix lint * move to touch/vo detection * Select on initial focus (#2026) * Select on focus first time in collection * fix lint * Only start selecting on first focus if selectOnFocus is on * add a test * fix aria * fix lint * remove dead code * fix lint * fix lint * Fix ctrl + alt + space * Hide checkboxes and add border for highlight selection mode * Expose selectionBehavior option on SelectionManager * Don't show focus ring when pressing modifier keys * Fix test * Fix table tests * Add useLongPress to @react-aria/interactions * Implement onAction support in TableView * Add highlight selection and onAction support to ListView * Fix tests * Fix ListView onAction with no selection * Only require alt key not ctrl + alt * Fix CardView tests * Prevent context menu on touch * Improve event cleanup * Change non-contiguous selection modifier depending on platform * Rename to selectionStyle in Spectrum and fix some bugs * Enforce selection mode better * code review * Remove global styles from story * Add stopPropagation back when continuePropagation is not available Co-authored-by: Rob Snow <[email protected]> Co-authored-by: Rob Snow <[email protected]> Co-authored-by: Daniel Lu <[email protected]>
Closes #1905
Fixes a bug where tabbing into a collection with selectOnFocus wouldn't select anything until the arrow key was used. Now this will select the item that first gains focus.
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: