How to ensure focus for menu's that support both keyboard and mouse navigation

Hi guys,

I am struggling for a while now with the issue that when a user clicks the keyboard focus might disappear or be lost completely. I have been looking on both the answerhub and forums, but either no answers or not good enough for my purposes.

To prevent losing focus completely i have a very simple border which completely fills the screen and is set to visible to ensure nothing behind it can receive keyboard focus.

Then there is the issue of dynamically loaded widgets, for example some shop to buy upgrades, after upgrading the external database is queried again to show the latest available upgrades, but that means the currently focused widget might disappear and another might re-appear a little later. To keep both mouse and keyboard navigation correct is quite hard, any suggestions? Currently i check if there is still any widget with keyboard focus and if not i have some fallback in place, but that is not really workable and can lead to strange behavior (especially when widgets appear/disappear).

Then my last problem i noticed with a few widgets which i think is a bug. If i have two buttons, A with focus , B without and i click on B it somehow registers a click on button A first and afterwards i can click on B. Anybody with the same experience and a way to work around it?

Any help is appreciated!

Cheers

Cageman