After some searching analyzing my kernel log, I discovered that's happening because some kind of incompatibility with my current video card driver. So, I just ran sudo apt install nvidia-384 and it worked well.
I believe that gnome is reverting the caps behavior, I had this problem as well.
You can change the gnome settings with gnome-tweaks (which you can apt install if you don't have it already)
Then run gnome-tweaks, select "Keyboard and Mouse" and then "Advanced Layout Options" - and then you can choose the caps lock behavior there instead of calling xmodmap.
Using Ubuntu 18.04LTS, I was looking for something that would help boot my System 76 laptop (Intel® Core™ i3-7100U CPU @ 2.40GHz × 4), with Intel® HD Graphics 620 (Kaby Lake GT2) in "Join Displays" mode, as opposed to "Mirror".
What I discovered was arandr. It's a very plain version of "Settings > Devices > Displays", which displayed the settings I had ...
I have the same issue with slack, after some digging found out that there is another way to change the keyboard layout w/o using gnome-tweak-tool which wont cause this side effect of losing the focus.
The solution is to use gsettings as explained here
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L']"
gsettings set ...