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

Mobile drag-and-drop support #17

Open
mfierro0 opened this issue Dec 18, 2021 · 3 comments
Open

Mobile drag-and-drop support #17

mfierro0 opened this issue Dec 18, 2021 · 3 comments
Assignees

Comments

@mfierro0
Copy link

Hey, really great library, thanks for the work!

As the selection and drag events differ on mobile and desktop, DnD behavior currently doesn't work on mobile. Is this on the roadmap? (Or how much work would it be to implement?)

I think the mappings are:dragstart is touchstart; drag, dragenter, dragover, dragleave is touchmove; drop, dragend is touchend.

@lukasbach
Copy link
Owner

Hi, thanks for the feedback! Not on the roadmap currently, but if it's not big effort, and really just a remapping, I'll try to include it in the next release.

@lukasbach
Copy link
Owner

I've looked into it a bit, but as it turns out, touch events are not quite as trivial to implement for tree views, so I've decided to leave them out for now.

Detecting whether a user is trying to initiate a drag event or just scroll by dragging requires quite a bit of additional logic (would listen for a touch down, then check if the user roughly keeps his thumb at the same location for about 0.5s, then move his thumb, then initiate a drag; otherwise if he moves his thumb sooner after he puts it down, ignore the event and interpret it as scroll event). Also additional handling for multi-select would be required. I think adding all of that bloat the library too much.

Note that there are programmatic ways to control drag interaction, so there are still ways to provide functionality to users on mobile endpoints, e.g. by

  • providing an option that toggles a select mode, where every click toggles an items selected state (should be possible with custom interaction manager)
  • provide buttons that control dnd, i.e. a "move items", and then programmatic controls to choose the target.

@jnorris441
Copy link

Instead of trying to figure out their intent, could you enable dragging only by a drag handle on mobile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants