Okay so even I was struggling with the same issue since a couple of days when I had accidentally did some changes to some Oracle VM VirtualBox host keyboard settings.
I have a windows 10 host machine with Oracle VM VirtualBoox 6.0 with guest OS - Ubuntu 20.04.2 LTS.
Problem : On pressing Alt
+ Tab
my system was switching to HOST windows OS and and switching the windows of Windows 10. So say if I have paint, word and VirtualBox windows open in Windows 10 then those 3 would be switched even when I am working inside VirtualBox's Ubunutu OS.
Solution :
Step 1 : So by trying alot of things and I understood that first I need to keep the option Auto Caption Keyboard
checked in ☑ in the VirtualBox Settings : File > Preferences > Input > ☑ Auto Caption Keyboard
.
Step 2 : In Ubuntu's settings > keyboard shortcuts...... Look out for something starting with "Switching". So search for "Alt+Tab" in the search bar of the settings tab.
The goal is to set "Switch windows" shortcut to "Alt+Tab" so if the result has something other than "Switch windows" then change that shortcut to some other shortcut say by pressing on the name of shortcut and then pressing Alt+Backspace(because this is hardly any registered shortcut in ubuntu so it'll avoid conflicts with existing same shortcut) or simply Backspace
key to destroy that shortcut if it's working in your system.
Then as we have now no shortcuts with "Alt+Tab" then click the shortcut named "Switch windows" and type "Alt+Tab" and set it !
And it should be working now.
- Remember to always to keep that
Auto Caption Keyboard
☑ checked because by its definition it means that whenever you press Alt
inside VirtualBox then the host OS shouldn't be able to read it.
"You have Auto capture keyboard option turned on.This will cause the Virtual Machine to automatically capture the keyboard every time the VM window is activated and make it unavailable to other application running....."
Earlier problems were happening because this option in Settings > Preferences > Input was not checked.