Reproduction steps:
1. Flag the "Detached" parameter in the context menu of an UI element (such as the autopilot or navball)
2. Drag the detached UI element outside of the game's window
3. Unflag the "Detached" parameter
Changing the game from windowed to fullscreen and/or vice versa before...