Black voters, including the few who managed to register in the South, identified as Republican until the mid-20th century. Harry Truman’s desegregation of the armed forces started to pull black voters to the Democrats. JFK’s support for civil rights, albeit mostly lip service, drew some more; the Civil Rights Act of 1964 sealed the deal.
With the possible exception of LBJ, no one was more instrumental in passing the 1964 Act than Everett Dirksen, GOP Senator from Illinois; but the Republicans never made civil rights a national campaign priority.
Those histories just aren't true, they are myths.