Comma before "while"

Solution 1:

Your sentence is correct.

Don't text while driving. Same idea with fewer modifiers and an intransitive verb.