Added focus and keypress support