This bug is related to bug #783434 and has been partially fixed by my branch lp:~3v1n0/unity/fix-783434. However I'm saying "partially" since it seems that using this fixed branch the previous focussed window is focussed again, but just in terms of keyboard focus. In fact it's not guaranteed that is the first mapped one (I mean, the on on the top level).
This bug is related to bug #783434 and has been partially fixed by my branch lp:~3v1n0/unity/fix-783434. However I'm saying "partially" since it seems that using this fixed branch the previous focussed window is focussed again, but just in terms of keyboard focus. In fact it's not guaranteed that is the first mapped one (I mean, the on on the top level).