Skip to content
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

feat: support selectionMode="replace" in grid collection test utils #8028

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Apr 2, 2025

Closes #7884

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@LFDanLu LFDanLu changed the base branch from main to test_util_bug_fixes April 2, 2025 22:31
@rspbot
Copy link

rspbot commented Apr 3, 2025

@rspbot
Copy link

rspbot commented Apr 3, 2025

## API Changes

@react-aria/test-utils

/@react-aria/test-utils:triggerLongPress

 triggerLongPress {
   opts: {
     element: HTMLElement
-  advanceTimer: (number) => void | Promise<unknown>
+  advanceTimer: (number) => unknown | Promise<unknown>
   pointerOpts?: Record<string, any>
 }
   returnVal: undefined
 }

/@react-aria/test-utils:UserOpts

 UserOpts {
-  advanceTimer?: (number) => void | Promise<unknown>
+  advanceTimer?: (number) => unknown | Promise<unknown>
   interactionType?: 'mouse' | 'touch' | 'keyboard' = mouse
 }

@react-spectrum/test-utils

/@react-spectrum/test-utils:triggerLongPress

 triggerLongPress {
   opts: {
     element: HTMLElement
-  advanceTimer: (number) => void | Promise<unknown>
+  advanceTimer: (number) => unknown | Promise<unknown>
   pointerOpts?: Record<string, any>
 }
   returnVal: undefined
 }

/@react-spectrum/test-utils:UserOpts

 UserOpts {
-  advanceTimer?: (number) => void | Promise<unknown>
+  advanceTimer?: (number) => unknown | Promise<unknown>
   interactionType?: 'mouse' | 'touch' | 'keyboard' = mouse
 }

@LFDanLu LFDanLu changed the title feat: (WIP) enhance selectionMode="replace" support in grid collection test utils feat: support selectionMode="replace" in grid collection test utils Apr 3, 2025
Comment on lines +107 to +108
// TODO: perhaps this should just be shouldUseModifierKeys?
selectionBehavior = 'toggle'
Copy link
Member Author

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

@LFDanLu LFDanLu marked this pull request as ready for review April 8, 2025 17:05
Base automatically changed from test_util_bug_fixes to main April 8, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants