-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Enable onAction with checkbox selection in ListView and TableView #3103
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
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
snowystinger
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.
With VO on iPhone, I noticed that I can start dragging in two ways, either the drag handle, or the new second long press to drag that all touch devices get.
In the second case, where I long press to start dragging, none of the announcements are read about how to perform the drag and drop or when it is completed.
Disabled Key f does not look very disabled? i had to look in the story to find out why I couldn't select or drag the item (ListView draggable-rows-selectionstyle-highlight-onaction)
In TableView selectionstyle-checkbox-onaction, if I use a mouse and click and long hold, it will not do action or selection when I stop. It also briefly flashes into active mode.
| checkRowSelection(rows.slice(1), false); | ||
|
|
||
| let checkbox = within(rows[1]).getByRole('checkbox'); | ||
| userEvent.click(checkbox); |
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.
stay in pointerType touch?
| onSelect(e); | ||
| } | ||
| if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) { | ||
| if (e.pointerType === 'keyboard' && !isActionKey()) { |
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.
how can we have a keyboard onPress that isn't an action key?
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.
Action key = Enter, Selection Key = Space
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.
Ah, yep, ok, weird thing then
https://reactspectrum.blob.core.windows.net/reactspectrum/b0e0b1d9f96ae8a0823015f9b74510194bb65205/storybook/index.html?path=/story/listview--selectionstyle-checkbox-onaction
If i select using space, then deselect using space. It triggers action when it deselects
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.
+1 to what Rob saw. Something similar also happens if the user selects a row via clicking the checkbox and clicks on the row to deselect it
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.
It should now only trigger onSelectionChange when de-selecting, not onAction. And when an onAction is defined, the Space key always selects, and the Enter key always only performs actions, not selection. Actions cannot be performed once in selection mode, matching mouse/touch.
This is the native drag and drop API - the same as you'd use without VO on. Long press is a passthrough gesture, so VoiceOver just lets it go through to the native dnd events. |
| fireEvent(el, pointerEvent('pointerdown', {pointerType: 'touch', pointerId: 1, width: 1, height: 1, pressure: 0, detail: 0})); | ||
| fireEvent(el, pointerEvent('pointerup', {pointerType: 'touch', pointerId: 1, width: 1, height: 1, pressure: 0, detail: 0})); | ||
| fireEvent.click(el, {pointerType: 'touch', width: 1, height: 1, detail: 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.
This test intentionally had a pointerType of mouse to mimic the Android Talkback specific case, mind if we change it back?
| onSelect(e); | ||
| } | ||
| if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) { | ||
| if (e.pointerType === 'keyboard' && !isActionKey()) { |
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.
+1 to what Rob saw. Something similar also happens if the user selects a row via clicking the checkbox and clicks on the row to deselect it
|
Note: I'm happy to approve and merge for Monday testing, everything else seemed to work just fine on Android/desktop |
…navigation # Conflicts: # packages/@react-spectrum/list/stories/ListView.stories.tsx
|
Build successful! 🎉 |
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.
Still seeing onAction get fired when the user deselects the row via click in this story but that can be followup. Approving for testing
Repro:
- Select the first row via clicking the checkbox
- De-select the row by clicking on the row itself. Note onAction is fired
|
Ughhhhh |
Back in #2363, we added support for
onActionin selectable collections such as ListView and TableView, along with support for highlight selection. However, we have use cases foronAction(i.e. folder navigation) with checkbox selection as well. This PR enables that.In order to implement this we made the following behavior changes:
onActionis defined, row actions become the primary click interaction instead of selection.onAction).Enterkey always performsonAction(on key up) when defined, whereasSpacetoggles selection (on key down).To do before release