I tried it on Ubuntu (18.04.2 LTS) and it works as desired. So it may well be a macos specific issue.
In fact, I believe that, in macos, the app code may need to specifically direct change-window-focus clicks to the app if it wishes the app to act on the click beyond the change of window focus.
Obviously possible though, given Chrome, Firefox and Safari all do it.
I am running macos 10.14.4 (Mojave).