They immediately unlock again. Or the button does nothing. I forget exactly. Basically, it's impossible to lock the key in the car. I imagine that's the logic.
As far as not locking when you walk away from the car, I have no idea. There is a 3rd party device to fix that though. I installed mine in about 20min, and I was being very carefully methodical with every step. It's easy.