Updated dismissKeyboard method