I am using JQuery ui with datepicker and when a user tabs on to a field, they appropriately get the calendar pop up.
I have added an empty href tag next to the datepicker input control and focus onto it in the onClose event handler. This solved my problem of the focus shifting all the way to the top of the page when the calendar was closed. I am using that href tag to display error messages; therefore it serves two purposes for me.