UIInput begins input (and shows the keyboard) when the object gains selection and stops input (and closes the keyboard) when the object loses selection. It sounds like in your case you should instead keep UIInput script disabled, and enable it in some other script as a result of OnClick, followed by UIInput.isSelected = true.