An (insufficiently) abreviated history of US politics WRT race:
Leading up to the 1850s, slavery -- especially the extension of slavery -- became the hottest issue in US politics.
Finally, a new party was formed, the Republican Party, whose primary tenet was the opposition to the extension of slavery into the territories.
They won the presidential election of 1860. The lower South seceded from the Union; President Lincoln, when finally inaugurated, called for troops to bring them back in; half the border states who allowed slavery then seceded as well.
The United States won the Civil War, and the Republican Party was identified with that victory.
Large groups of whites in the South forgot that they had responded to losing an election by opting for a trial by combat; their story was that all the changes, including emancipation, citizenship for Blacks, and industrialization, had been imposed by northern states on southern states by invasion and conquest.
Armed groups (the KKK was the survivor) took to violence aggainst Blacks and Republicans.
While several southern states formed Conservtive Parties, the nation settled on Democrats and Republicans. Southern racists -- the only southerners who kept the vote -- became solid Democrats.
After the war, the Republican Party grew to dominate national politics and the politics of most states. Labor and reformers saw no chance in the dominnt Republican Party, and tried to gain power in the smaller Democratic Party. They often succeeded. There were also movements for progressivism and a Farmer-Labor Party.
In 1912, the VS-born Progressive (in most ways) Democratc governor of NJ got the Demcratic presidential nomination. With hiccups, northern Progressives moved to the Democrats.
During World War I, millions of Blacks moved north. They could sudenly vote, and -- remembering Lincoln -- they generally voted Republican.
By the '20s, the Democratic Party had a southern wing -- locally dominant -- which was racist, conservative, and generally rural, and a northern wing -- seldom dominant on the state level, although often on the city level -- consisting of organized labor, most intellectuals and liberals, most immigrants, and many city machines.
The Great Depression pushed that Party into power. The New Deal programs were designed by northern liberals -- typically liberal about race as well. Al the rules were writen color-blind in words; most of them were color-blind in effect as well.
Urban northern Blacks, meeting the first color blind set of laws they'd ever met, turned Democratic. (THE Black congressman, a Republican from Chicago, lost. He changed parties, won, and had a long career as a loyal part of the Chicago Democratic machine.)
Rural programs -- whether by accident or intent -- subsidized the land OWNER. Southern Black sharecroppers got no benefit from the New Deal and remained sympathetic to the Party of Lincoln.
In 1948, northern liberal delegates to the Democratic National Convention pushed through a civil-rights plank to the platform. Southerners bolted for the second time in 90 years. They ran a states-rights democratic party slate in a few states. Truman -- from the border state of MO -- won anyway. Truman integrated the armed services, and the South remained Democratic but dissatisfied.
In the 50s, conservative northern Republicans and conservative southern Democrats cooperated to dominate Congress.
Prior to the election in 1964, Johnson pushed through a voting-rights act. Senator Goldwater from AZ voted against it. When Goldwater was the Republican nominee for president, he got votes from 6 states, AZ and 4 southern states, SC, GA, MS, LA. None of those southern states had voted Republican in 1960; 3 had voted for Kennedy, and MS and some of the electoral votes of AL went to the protest candidacy of Byrd.
(Based only on memory, the defection of southern racist voters -- and some politicians -- to Republican ranks was widely welcomed by northern Republican spokesmen.)
In 1992, when Bill Clinton of AR and Al Gore of TN were the Democratic slate, the only one of the 4 census regions which they did not carry was the South.
To say that the White South defected from the Democratic Party to the Republican Party over the issue of race is no leap of the imagination.