TAB automatically focuses on elements

Hi everyone,
I’m experiencing an issue with a settings menu. I use TAB to open and close it. After changing mappings in an input key selector, the TAB key doesn’t remove the widget but focuses on the key selector or the next one : the key selector gets a blue rectangle on it. The point is, there is no " is focusable " option, and I need to click somewhere else on the screen to be able to close the menu.