There are different sorts of focus shifts.
One is what happens in certain lenses (the EF 50 mm f/1.2L USM is an infamous offender) when they are stopped down, and the focus moves due to some stupid laws of nature.
The other is due to light of different wavelengths being handled differently by the lenses, so that the AF metering chip sees different distances to the subject depending on the light source that illuminates it.
The first one you can't do much about in the camera. The second one the camera tries to combat by measuring the incoming light and adjust accordingly.