Bug 1023048 - [UITest] The condition of keyboard dismiss is not correct

Uplift from #21109