Is there some legal basis for all this?
I posted this earlier:
Article IV
SECTION 4. The United States shall guarantee to every State in this Union a Republican Form of Government, and shall protect each of them against Invasion; and on Application of the Legislature, or of the Executive (when the Legislature cannot be convened) against domestic Violence.
I’m actually not sure how relevant this provision is to federal elections. It may only be addressing the way a state is allowed to choose its state officials. Aside from possibly this aforementioned clause it does not appear that the Constitution provides any restrictions in how electors can by chosen by state legislatures. Article II, Section I, Clause II seems to give the legislature full discretion on how they choose their electors. There doesn’t appear to be any provision in that section of the Constitution that requires state legislatures to follow the popular will of their state.