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

refactor: improve multiselect behaviours #844

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

alexfreska
Copy link
Member

@alexfreska alexfreska commented Dec 10, 2024

changes

  • Multi-select now supports single select, toggle select, and range selection interactions, with click, ctrl-click, and shift-click.
  • Table now prevents default on any mouse down with shift held. This ensures the user does not highlight text while shift selecting a range of rows.
  • Renamed selectionMap to selection in the useMultiSelect hook API.

overview

normal click (single select):

  • The selection is reduced to the clicked row, and the range selection anchor is updated.
  • Clicking the only selected row does not deselect it.

ctrl/cmd-click (toggle select):

  • Toggles selection of an individual row without affecting others.
  • If selected, updates the anchor to that row.
  • If deselected, the anchor is updated to the nearest selected index, first checking higher indices, then lower. If no index is found reset the anchor.

shift-click (range select):

  • Always select the full continuous range between the anchor and the clicked row, deselect all rows between the anchor and the last range end from the same anchor.
  • Do not update the anchor on shift-click, unless there is none set yet.
  • If no anchor is set, the range select will use the top row as the anchor and set the range end to the selected row.

anchor

  • Whenever the anchor is updated, the range end is reset.
  • Whenever the anchor is reset the range end is also reset.

video

I could not get screenstudio to show the keypresses, but the following video shows some of the new multi-select interactions, such as how ranges are selected and rows between the anchor and the previous range end are deselected.

multiselect.mp4

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hostd ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 11:52pm
renterd ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 11:52pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Dec 10, 2024 11:52pm
explorer-zen ⬜️ Ignored (Inspect) Visit Preview Dec 10, 2024 11:52pm
website ⬜️ Ignored (Inspect) Visit Preview Dec 10, 2024 11:52pm

Copy link

changeset-bot bot commented Dec 10, 2024

🦋 Changeset detected

Latest commit: 60794e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@siafoundation/design-system Minor
hostd Minor
renterd Minor
walletd Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Member

@peterjan peterjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet

@alexfreska alexfreska merged commit c909ad2 into main Dec 11, 2024
37 checks passed
@alexfreska alexfreska deleted the improve_multiselect_behaviours branch December 11, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants