Toyota doors will lock keys in igintion
Then don’t do that!
My Mustang allows me to lock and unlock the doors with or without the keys in the ignition. I suspect most brands do this.
With the doors closed, yes but with the drivers door open and a key in the ignition the drivers door lock switch should not respond, this precaution started in the 1980’s.
If the OP is able to lock the keys in the car while they are in the ignition there may be a problem with the drivers door ajar switch, the door lock module does not recognize that the driver is exiting the vehicle.
Hmm, never tried that, I’ll check it out.
Performed the experiment. With drivers door open, pressing the lock button on the door, door would lock then immediately unlock. Using the fob I could lock the door when open and could lock the door from the outside with the engine running. The automatic unlocking surprised me, but the fob function did not. This allows the driver to leave the vehicle running, a common practice for our two legged K-9 officers to provide AC for their four legged K-9 officer partners.