Improve keyboard focus handling.