Fix multiple issues in KeyNav and Widget.

I've attached a new functional tests for KeyNav. You can run it against the unmodified KeyNav and Widget class to see the current issues.