I think some states now have done away with that defense.
The gay panic defense is a legal strategy in which a defendant claims they acted in a state of violent, temporary insanity, committing assault or murder, because of unwanted same-sex sexual advances. A defendant may allege to have found the same-sex sexual advances so offensive or frightening that they were provoked into reacting, were acting in self-defense, were of diminished capacity, or were temporarily insane, and that this circumstance is exculpatory or mitigating.
The trans panic defense is a closely related legal strategy applied in cases of assault, manslaughter, or murder of a transgender individual with whom the assailant(s) had engaged in or was close to engaging in sexual relations with and claim to have been unaware that the victim was transgender, producing in the attacker an alleged trans panic reaction, often a manifestation of homophobia and transphobia.
They are often used by men to justify hate-crimes or the intentional assault or murder of gay men or trans women.
https://en.wikipedia.org/wiki/Gay_panic_defense