I've seen "when and while" in different situations, for example past continuous and past simple.
While I was having a shower, the telephone rang.
I was having a shower when the telephone rang.
As you can see while is followed + past continuous and when + past simple.
I hope that helps.
Student or Learner