Skip to content

Guide on click and drag

Placing and moving blocks in MakeCode typically requires dragging blocks using a trackpad, mouse or touch controls. This can be challenging for some students.

Click and drag can be avoided entirely by using keyboard controls in MakeCode. But for students who prefer to use a mouse or pointer for some of their coding, this page outlines some approaches to make using MakeCode easier.

Keyboard navigation for moving blocks

If you turn on keyboard controls in MakeCode, you can use a mixture of keyboard and mouse or touch, as appropriate to the individual.

For example, you could select a block by clicking or tapping, hit "M" to enter move mode, and then use arrows to put the block where you want it. For more information, see keyboard controls in Microsoft MakeCode accessibility support.

A MakeCode program with a pause block in move mode, ready to be moved by the arrow keys

Selecting blocks from the toolbox

When selecting a block from the toolbox using touch or mouse, the simplest approach is to first tap/click on the block, which closes the toolbox flyout and places the block on the workspace, before clicking again and dragging it into its intended position. This avoids having to do a long drag in one motion.

Formatting code to rearrange blocks

If you end up with blocks on top of each other as your program grows, you can select “Format Code” from the right-click menu to automatically tidy up the blocks on your workspace. If you have keyboard controls switched on, you can press “F” to format.

Alternative pointing devices

Alternatively, some students may benefit from using a USB mouse (possibly smaller for small hands) or an alternative pointing device, such as a trackball or rollerball. An external trackpad may also be helpful as it allows more flexible positioning than a built-in trackpad. There are also accessibility settings described below which can make it easier to perform a click and drag action using a trackpad or mouse, depending on the type of computer you are using. 

A mouse with a trackball on the top and two large buttons on the sides
An extra small USB mouse
A person using an external trackpad with a stylus in their hand.

MouseKeys

Windows, Mac and iOS and ChromeOS all offer a MouseKeys option which allows you to control the mouse cursor with a keyboard (for example with the NumPad number keys). In particular, if you can comfortably move your mouse but find it hard to start, maintain and stop a mouse click you can use shortcut keys to start and end the drag.

ClickLock on Windows

On a Windows PC, you can turn on ClickLock which affects drag actions with both a trackpad/touchpad or a mouse cursor (or alternative pointing device). Using ClickLock allows you to start a drag action with a long click on a code block, then the block will remain attached to your cursor until you click again. This doesn’t require you to hold down your finger on the trackpad/mouse for the whole time, so you can move the block gradually and confirm when you are happy with the new location by clicking again.

Drag Lock on Mac OSX

On a Mac, there are pointer control options which affect how you can do drag operations with a trackpad. If you turn on Drag Lock, you can double-tap a code block, move your finger on the trackpad, without needing to keep it held down, and then click again to complete the drag. It is also possible to perform a drag operation with three fingers, without needing a ‘click’.

Chromebook trackpad options

Chromebooks have a built-in trackpad. Some Chromebooks also have a touchscreen, in which case you can use either option for dragging blocks.

Using the touchpad, there are different ways to drag a block, depending on your settings.

  • Use one finger to click and hold the block you want to move. Drag the item to its new spot, then release your finger.
  • Alternatively, use one finger to click and hold the block, and another finger to move the block. This allows you to lift the second finger from the trackpad during the drag operation, which can make it easier, however it does require two fingers to be used at the same time.
  • If you turn on “Tap and drag to move items” in the Chromebook settings, you can perform a drag operation without needing to click the trackpad down. Double tap on the block you want to move, and move your finger across to the target location. You can also split this into two fingers, as above - one finger performs a double tap, and the other finger moves the block.

Mouse options on iPad and Android tablets

If a student is struggling to click and drag on a tablet’s touch screen, they may be able to use a USB or Bluetooth mouse (or other alternative pointing device) to control MakeCode. In this case, both Android and iOS have accessibility settings such as dwell selection and drag lock. See the following links for more details.