If condition not working with input from keyboard component