Tamar is childless and widowed - not once, but twice. Tamar’s dead husbands were the elder sons of Judah. In order to have a child, Tamar tricks Judah by adopting a disguise, covering her face, and pretending to be an anonymous prostitute. Not knowing it is Tamar, Judah gets Tamar pregnant.
Judah is angered when he discovers that Tamar is pregnant, but does not yet know that Tamar was the anonymous woman with whom he slept. In his mind, Tamar is the widow of his two elder sons, how could she be pregnant!?! Judah’s anger prompts him to threaten Tamar.
Tamar unmasks herself so that Judah will know the truth of who she is. But she takes great care to unmask herself discreetly so as to not humiliate or shame Judah. In response, Judah drops his threats and admits his error saying, “She is more righteous than I am” (Bereisheet 38:26) Tamar is celebrated with the birth of twin sons, one of whom is identified in the Hebrew bible as a direct ancestor of King David.