-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: support selectionMode="replace" in grid collection test utils #8028
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
base: main
Are you sure you want to change the base?
Conversation
now we shouldnt need to call runAllTimers after selectOption
… into highlight_selection_test_util_support
if a checkbox wasnt present we werent using the keyboard navigate logic flow
…gation simulation to util
// TODO: perhaps this should just be shouldUseModifierKeys? | ||
selectionBehavior = 'toggle' |
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.
This API naming feels unclear TBH, people may be confused as to when they would apply it. When set to selectionBehavior="replace"
this causes the alt/meta key to be used when keyboard navigating/pressing to select a row so that it doesn't cause your previous selection to be replaced on focus/click. I wasn't certain if something like shouldUseModifierKeys
was clear either since a user may not know what the "modifier keys" even do
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.
I think selectionBehavior is fine or gridListSelectionBehavior if you want to be clear it should match, then the user profiles/interactions should handle most things behind the scenes
…_selection_test_util_support
@@ -22,6 +22,7 @@ | |||
"url": "https://github.com/adobe/react-spectrum" | |||
}, | |||
"dependencies": { | |||
"@react-aria/utils": "^3.28.1", |
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.
I don't think we should have a dependency going in this direction, test-utils should never depend on our actual packages
too easy to make a circular dependency
import {UserOpts} from './types'; | ||
|
||
export const DEFAULT_LONG_PRESS_TIME = 500; | ||
export function getAltKey(): 'Alt' | 'ControlLeft' { |
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.
? what does isMac
return in a test environment?
I feel like we should hook this into the user config if we need it
// TODO: perhaps this should just be shouldUseModifierKeys? | ||
selectionBehavior = 'toggle' |
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.
I think selectionBehavior is fine or gridListSelectionBehavior if you want to be clear it should match, then the user profiles/interactions should handle most things behind the scenes
Closes #7884
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: