Read Damon Muma on this. He proposes the following jQuery solution (inspired by Thompson, fixed by me):
// Apply focus properly when accessing internal links with keyboard in WebKit browsers.
$("a[href^='#']").not("a[href='#']").click(function() {
$("#"+$(this).attr("href").slice(1)+"").focus();
});