To fix this issue first try vacuuming up debris and grime from the track with a crevice attachment.
Sliding door on wrong track.
When the sliding panel is on the outside track there is nothing preventing an intruder from removing the slider and entering your home.
These rollers can become damaged dirty or broken as the years go by and cause your door to stick.
Step 1 clean the track a dirty obstructed or damaged track can make a sliding closet door jump off its track.
Also the lip on the outside track helps keep water from getting into the house when doors are closed.
To fix this remove your door from the tracks clean out the rollers and spray them with a lubricant such as wd 40.
When the slider is on the inside track the only way to remove it is when the stable panel is removed.
Then wipe it with a damp rag.