As noted, in some places sidewalk cycling is prohibited by law. If you are going to cycle on the sidewalk, drop down to pedestrian speeds when you encounter other users. That or dismount. If a family with kids in a double wide stroller approach, dismounting and moving off the sidewalk may be the right thing to do. Walk is the operative word in sidewalk. When you aren't walking it's your duty to have safe and courteous interactions with users who are walking.