Creating a draggable button goes wrong. Possible bug?

Ive seen it was created in this tutorial that is old enough
But now its not working that way as I see