This was driving me crazy for a bit and noticed a few unsatisfying attempts to answer it on this list.
Basically, jqModal registers an event on body that forces the window to move to the first input element when the user clicks anywhere outside of the main dialog. And since the datepicker window actually lives off of body, periodically clicks on the datepicker wouldn't be registered (ie. they'd get eaten by the jqModal event instead). No amount of z-index tinkering will fix this. There are several possible solutions, but the one I chose was to just kill the jqModal event that's doing this. If you decide to do option 2, find the line f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, and replace it with f=function(h){return},