fluid-lab / gamepad-navigator

GSoC 2020 project
Other
7 stars 10 forks source link

Add ability to drag and drop. #77

Open the-t-in-rtf opened 3 years ago

the-t-in-rtf commented 3 years ago

In recent work with the HTML5 drag and drop API, I'm realising that it may be possible to support drag and drop using a joystick. For example, a thumbstick press might start and stop dragging. Here's a description of a sample scenario:

  1. A user navigates to an element that supports drag/drop.
  2. Vibration or some other feedback helps them understand that the element is draggable.
  3. The user presses the thumbstick down to begin the drag action.
  4. The relevant events to start a drag are triggered on the element that has current focus.
  5. The user navigates to an element that can accept dragged materials.
  6. Vibration or some other feedback helps them understand that the element accepts dragged materials.
  7. The user presses the thumbstick down to end the drag action.
  8. The relevant events to end a drag are triggered on the element being dragged and the element accepting the dragged item.

There are some limitations with this that need to be addressed, for example, making sure the dragged item is notified of its position as the user navigates around. We'd also need to talk about whether this would actually work with our current approach, i.e. whether drag and drop elements tend to be focusable. If not, we might need to use a similar strategy as we use to identify elements that are focusable, i.e. search for elements that can be dragged and that can accept dropped elements, and navigated between them, perhaps in a special "mode" where other controls are temporarily ignored.