The transponder codes are changing while in flight

Do you have the virtual co-pilot in use to handle ATC comms?
Are you interacting with the ATC window when that happens?