-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
website: Drag handles for ranking items #230
Conversation
…lear they can be dragged. The formatting changes to the SortableItem also had the side-effect of removing the dot points.
…the webpage layout. When the items are drag-able outside the page boundary the viewport leaves the page boundary. This looks particularly unprofessionally on mobile. There is also another option to restrict to the page boundaries (restrictToWindowEdges) which might be better but it doesn't appear to work on mobile (firefox); the issue is that the items get stuck slightly off to the left edge of the viewport and can't be moved horizontally at all (even without restrictToVerticalAxis).
sortableKeyboardCoordinates, | ||
verticalListSortingStrategy, | ||
} from "@dnd-kit/sortable"; | ||
import { restrictToVerticalAxis } from "@dnd-kit/modifiers"; |
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.
small nit, could you move this import up above sortable so it's in order?
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.
Sure, just to confirm external imports should be alphabetically by @scope / unscoped name, then by scoped package name? so:
- a
- @b/a
- @b/e
- c
- c-foo
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 with the new eslint change that goes in @
is always first. So it'd be
@b/a
@b/e
a
c
c-foo
Adds drag handles, to the rank prompts and replies pages of the website.
Closes #223
Removed the dot points that were appearing next to each item. Restrict ranking items to vertical motion to avoid breaking the webpage layout; there is an even better option to restrict to the window but that didn't seem to work on mobile (firefox) were the issue looks the most unprofessional.
Also enabled the keyboard sensor so that the items can be moved without a mouse. To use select one of the drag handles with
TAB
or the mouse to give it focus, pressENTER
orSPACE
to start moving the item and use the arrow keys (up or down) to reorder the items, pressENTER
orSPACE
again when done,ESCAPE
cancels the action. There is a full description at https://docs.dndkit.com/guides/accessibility#keyboard-shortcuts which also mentions we might want to customise the screen reader prompt.