Why was Tamar more righteous than Judah? Genesis 38 tells the story of Judah and Tamar. At first Tamar was married to Er (Judah's firstborn son) but he was wicked and killed by the Lord v6-7. So Judah tells Tamar to wait until his youngest son, Shelah, grows up v11 (to marry her?). Years go by and Tamar is never given to Shelah as a wife so Tamar disguises herself as a prostitute and Judah sleeps with her since he doesn't recognize her. When he finds out she's pregnant, he wants her burned to death but she proves he is the one who impregnated her to which Judah replies, "She is more righteous than I, since I wouldn’t give her to my son Shelah" v26.

Why does Judah say that Tamar is more righteous than himself? I feel like I'm missing something.
From the Haydock commentary:


  Juster. For Juda had been guilty of injustice; and had thus exposed her to the danger of following a life of lewdness. (Haydock) --- She
  remained a widow afterwards, as she was now rendered unfit to be
  married either to Juda or Sela. The latter married another woman,
  Numbers xxvi. 19. (Calmet) --- While Juda was engaged in this unlawful
  commerce, and yielded to the temptation, Joseph was triumphing over a
  much greater temptation, in rejecting the solicitations of his
  master's wife. (Haydock)


Basically, by not following through on his promise to have his son Sela marry her, Judah exposed Tamar to the danger of making a living as a prostitute as she did not have any other way to support herself in her widowhood.  As such, Judah was more at fault; or stated the other way around: Tamar was more just than Judah (calling Tamar more just could be a vestigial idiomatic construct of the Hebrew language).