What is the best way to toggle a mouse-driven UI overlay?

You could be doing something else to make the cursor visible. When you say that the “focus doesn’t shift back to the viewport”. Do you mean that your keyboard and mouse do control the camera?

Cursor visibility is determined by the OnCursorQuery() call. The SViewport has one of those, and it forwards it. You can set a breakpoint in there to figure out what type of cursor it is returning. EMouseCursor::None will hide the cursor when the mouse is over a widget. That is what SViewport will return to make the cursor disappear. However, it delegates the logic to other code; you can step through to see what is being returned.