That means that they are not yet responsible enough to be in the bathroom alone. Someone always has to be there to watch over them. And if you have things that the child can reach, like cosmetics, toiletries there, you need to put them out of their reach.
Do not make him or her feel guilty about it and let them know that everyone has accidents and that there is nothing to be ashamed of. You want to encourage them and not bring them down. Children at this age are very emotional, they can get their feelings hurt very easily.
This is not unusual. Be supportive, as the child is already embarassed. If it continues, there may be a medical issue and you should discuss it with her doctor.
You should encourage the child to visit the bathroom more regularly, until they can stay dry for longer periods. You could try a reward system, such as stickers!