That is politicians for you. Note that much of the civil rights legislation was passed by the Republican Party over the objections of the Democrats. However, the Democrats insist on claiming credit for it.
As an example, "affirmative action" was actually created by President Nixon who first applied it to the building trades and then to racial quotas.
During the 2012 election cycle, in correcting a statement on the Democratic National Committee website that claimed the party has led the fight for civil rights for 200 years, the Washington Post noted:
Certainly President Lyndon Johnson, a Texas Democrat, played an
essential role, but it is worth remembering that 80 percent of the
"no" votes in the Senate came from Democrats, including the late
Robert Byrd (W.Va.) and Albert Gore (Tenn.), father of the future vice
president. Republican votes, in fact, were essential in winning final
passage of the bill.
Since the president is the one who signs a bill into law, he takes the opportunity to have the "photo op" and claim credit for it. If it fails or is regarded as bad by the people, then he will blame the other party and the congress.
"Heads I win, Tails you lose"