Dropping your keys interrupted you or stopped your from opening the door, so while, not when.
Here's a great source on when/while: Learning English | BBC World Service
Student or Learner
Please, fill in the gap:
I dropped my key ______ I was trying to open the door. (when/while)
Thanks for the link. I suppose both answers are correct because in the textbook when is used.