What window manager are you using? The default Unity, or something else?
On Ubuntu 17.10, I can only see this problem with GNOME, which seems to be partly due to the focus stealing prevention they baked in. My 16.04 VM needs to be re-installed, so I won't be able to reproduce on your version till later today.