google / blockly-keyboard-experimentation

Apache License 2.0
6 stars 4 forks source link

Make it possible to move blocks on the workspace #106

Open cpcallen opened 3 weeks ago

cpcallen commented 3 weeks ago

It should be possible to choose where to place newly-created blocks on the workspace, and to move existing blocks to new locations.

There should be a new mode that shall be in effect while a block is being moved (i.e., while it is 'picked up', as described below).

There should be two types of movement, which the user can easily and seamlessly (but not unintentionally) switch between:

  1. Constrained movement: the block can be moved only between valid positions (for that block) within existing stacks.
  2. Unconstrained movement: the block can be moved to any xy position on the workspace.

Specifically:

Points for further discussion:

cpcallen commented 1 week ago

I'm about to rewrite the description for this issue, based on plans decided in discussions last week between members of the Blockly team and @microbit-lucy, so for posterity here was the original description, with some updates:

It should be possible to move blocks upon or after placement on the workspace. In particular:

  • [ ] It should be possible to pick up an existing block (perhaps by pressing enter on it).
  • [ ] It should be possible to attach the block being moved to any valid input on the workspace.
  • [ ] It should be possible to move the block to any free space on the workspace.
  • [ ] New blocks created on the workspace (e.g. by selecting the block from the toolbox when the marker is not active) should start "picked up", ready to be moved.
  • [ ] There should be an affordance to indicate when a block is in the process of being moved.
    • This could be in the form of a drop shadow, making the block appear to be floating above the others.

To Discuss

How does dragging work in general?

  • Should dragging with the keyboard work like it does with the mouse, where the cursor keys just move the block around the workspace cartesian space in small increments, with insertion markers shown when the block is close enough to attach it?

The consensus was that this should not be the primary mode, but is needed at least for positioning top-level blocks on the workspace.

  • Should the arrow keys navigate only between valid attachment points?
    • To allow placement of new top-level blocks we could provide fake 'attachment' points above, between and below each top-level stack, moving stacks as necessary to keep them cleaned up.

It was agreed that moving blocks between valid attachment points was the most useful behaviour by default.

Providing specific placement points on the workspace "between" stacks was discussed, because it seems especially helpful for unsighted users, but there wasn't an obvious way to do that when stacks can be arranged arbitrarily in two dimensions. Instead, it was felt that as long as it was possible to place a block somewhere on the workspace (e.g. by using the unconstrained x-y dragging discussed above), the existing cleanup shortcut was sufficient to take care of the need keep stacks arranged on the workspace.

  • Or a mix of the above—e.g. snap–to–valid-location when among other blocks, but cartesian on empty sections of the workspace?

There was some discussion of whether it would be useful for dragging to switch from constrained to unconstrained automatically—e.g., if the user pressed an arrow key 'past the edge' of the set of valid locations (off top of top stack, buttom of bottom stack, or left or right past the end of the current 'line')—but it was observed that this makes ti too easy accidentally move out into the workspace without a guaranteed easy way to get back back to one's previous location, and this might be particularly problematic for unsighted users. Instead, it was felt that it would be better to make the user give an affirmative indication that they wanted to move unconstrained (e.g. by pressing a modifier key).

How should keyboard dragging interact with mouse dragging, if at all?

  • What happens when the mouse is clicked while a block is being dragged using the keyboard?
  • What happens when the cursor keys are used when a block is being dragged using the mouse?

This was not discussed directly, beyond that: