Here's what it says:
[The President] shall have Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two thirds of the Senators present concur; and he shall nominate, and by and with the Advice and Consent of the Senate, shall appoint Ambassadors, other public Ministers and Consuls, Judges of the Supreme Court, and all other Officers of the United States, whose Appointments are not herein otherwise provided for, and which shall be established by Law: but the Congress may by Law vest the Appointment of such inferior Officers, as they think proper, in the President alone, in the Courts of Law, or in the Heads of Departments.
Where here does it say that advice and consent can only be given if the same political party controls the Presidency and the Senate? Spoiler, it doesn't, because the framers didn't envisage political parties.
Now, the Senate can not consent, of course. They can cast a vote and reject the President's treaty of nominee for any post. But they're duty bound to vote.
If the Democrats had control of the Senate, it wouldn't have been an issue. They didn't have control of the Senate. Do I think that it was "wrong" to not even have a vote? Sure. But politics isn't about being right or wrong. It's politics. It can be as back-stabby and brutal as anything else. It's not like Garland was the only judge that didn't even get a chance. He was just another example when the confirmation doesn't roll through due to a party differential.
~Jeordam
Yes, politics isn't about being right and wrong. Which is why politics can have political consequences. Like Democrats adding more judges to the Supreme Court. That would be the next political move in the game. You cannot call for the smelling salts at that, but not at Garland not getting a hearing. Which, by the way, was the first for a Supreme Court nominee.
And adding justices to the court is actually thoroughly legal. The Constitution literally gives that power to Congress. The Dems wouldn't even have to violate the constitution to play politics like the Republicans did. So learn to live with it, and quit the hypocricy.