I realize this was probably a fear reflex without though but just for general awareness it is a bad policy to give food for bears. Black bears are very rarely aggressive (about 2 in a million displays predatory behavior toward people, most will actively avoid people) but once they learn that people or campsites can be a source of food their natural curiosity and desire for any easy meal will trump their natural recalcitrance, and thoughtless people will even deliberately lure them over to take a picture, then when the bear finds itself far too close for comfort it will make a defensive swipe at the person to try to get distance. These are rarely more than scratches but black bears do have sharp claws for climbing and can leave some consequential gashes on bear skin or get snagged on thick clothing, and once that is reported the bear is essentially marked for removal if Fish & Game or other pertinent agency can find it.
“A fed bear is a dead bear” is the mantra of people who work with wildlife, and the best thing you can do for them, both in terms of minimizing adverse reactions and for the nutritional health of the bear is to secure your food and trash so that they forage for the food sources that are naturally available to them.
Stranger