I found in a textbook on technical writing that the following expression is incorrect.
Entering the secret code, the gate will open immediately.
The book says that the correct expressions are the ones below.
When you enter the secret code, the gate will open immediately.
When the secret code is entered, the gate will open immediately.
From the "be concise" perspective, I think the expression in the title is even better, but I am not confident enough. Please advise, and thank you for your help.