Improve the focus handling of the Ui elements