Reset the selection before moving widget from one place to another.
Avoid changing DOM so undo snapshot won't be recorded.