So, you might be attacked before you are even aware that they are there at all. I have been lucky every time I met a bear in the wilderness.
the first time I was 17 years old hiking near Yosemite Falls in Yosemite national Park. I had just walked underneath Yosemite Falls which was possible then because it has a cave going into the mountain where the water drops onto the rocks below so you could stand then behind the Falls which is an amazing experience especially for a 17 year old boy.
Then I was walking down the trail and saw a bear and both of us were equally scared so we both went opposite directions away from each other and also this was a black bear of the ones that still live in the Yosemite area. (Though the Grizzly Bear is on our California Flag they were hunted to extinction at least in California). However, they have survived okay from about Teton National Park up through Yellowstone and Glacier national Park and up into Canada. So, if you are up there then Grizzlies can be a problem if you are not careful.
But, at least now even though one is on our California state flag they have been extinct in California for some time now.
The next incident with a bear was a really large male black bear which is likely the biggest black bear I have ever seen in the Mt. Shasta area. I was driving my International harvester 1974 6 cylinder 4 wheel drive Scout II over 4 wheel drive roads between McCloud and Medicine lake and the huge male came out of the manzinita bushes onto the dirt road we were on. As he raised up on his back legs to fight us so his front paws could do damage I backed the 4WD up so he wouldn't rip the hood off the vehicle or rip one of the doors off or break a window (which they can do). When he saw us back up he went down on all 4s again and walked off across the road into another set of Manzinita Bushes to our left.
Though it was an amazing experience we were lucky to not have any more problems than we did. So, though the bear threatened us we were safe in our vehicle and once the bear realized we weren't threatening his life he went back down on all 4s and walked away off into the wilderness.
The next incident with a bear was in Yellowstone where I was driving through an area where a lot of vehicles had stopped. We were driving our motorhome which we had driven from California there and so I pulled over too once I asked someone what was going on. It turns out there was a grizzly bear eating flowers on a meadow. So, my wife was too scared to see but I wanted to see the Grizzly and so I left my wife and daughter in the Motor home and walked over closer to the bear. There was a ranger there with about 25 people that were kept at a safe distance so they wouldn't be killed by the Grizzly. However, one idiot didn't listen to the Ranger and so was arrested instead of the Bear Killing him from coming to close to the bear.
The bear didn't seem to worry about any people it was just sort of like a "Flower Child" bear in ecstasy eating flowers in a meadow and couldn't have been happier with the sunny beautiful day and wonderful tasty flowers.