State representatives unanimously passed a bill on Wednesday they said would update Massachusetts law to better reflect the diverse ways people build families.

The bill lays out clear paths to establishing legal parentage for families that have children through assisted reproduction, like surrogacy and in-vitro fertilization.

Rep. Michael Day, the House chairman of the Judiciary Committee, said many families throughout the state find that when a child wants to open a bank account, has to visit an emergency room, or needs decisions made about their long-term care, “the person they call mom or dad is shunned legally” because they are not biological parents.

Supporters say the legislation would correct a situation where same-sex couples can end up needing to adopt their own children – a costly and complicated process – to ensure their legal rights.

“Reproductive equity is not a reality in Massachusetts until every individual — and every LGBTQ+ family — is able to make decisions about whether and when to parent, and to parent with dignity,” Reproductive Equity Now President Rebecca Hart Holder said in a statement. “This bill will protect family formation in a post-Dobbs world, ensure that LGBTQ+ parents have the protections they need to start or build their families, and support children’s development and well-being over a lifetime.”

Speaker Ron Mariano last week tapped the bill, which advocates have been pushing for since at least 2017, as a Pride month priority for the House. It needs Senate approval to become law.

Rep. Sarah Peake, a Provincetown Democrat, called the bill a “tune-up to our statutory structure to reflect the modern and contemporary ways that people become parents, whether they’re straight or gay.”

“As somebody who’s the beneficiary of marriage equality, I kind of thought when we were all allowed to marry 20 years ago that all of this stuff around parenting and surrogacy and parental rights and what birth certificates look like and all of those kinds of things would be taken care of by marriage equality,” said Rep. Sarah Peake, a Provincetown Democrat. “But … that wasn’t the case. What we’re doing today is clearing up and cleaning up archaic laws and antiquated laws.”

House lawmakers positioned the bill and its widespread support as a contrast to political moves elsewhere in the country.

Somerville Rep. Christine Barber said the House vote comes “at a time when so many other states are turning their backs on the LGBT community and creating barriers to reproductive justice.”

Peake said it had been a “wonderful experience” to work across the aisle with another main proponent of the bill, Shrewsbury Republican Rep. Hannah Kane, “in these times when we read how infrequently that happens.”

Kane said the issue is personal for her.

“Our daughter is lesbian and, as she chooses to, I want her to experience the joy of being a parent someday, with the same rights to establish her parentage and the same legal protections as her dad and I did,” Kane said. “I want our future grandchildren to have the security of legal parentage, regardless of the circumstances of their birth, and I want that for all LGBTQ+ families, for our daughter and countless others like her.”

The bill also has bipartisan backing in the Senate, where its lead sponsors are Sen. Julian Cyr, a Truro Democrat, and Minority Leader Bruce Tarr, a Gloucester Republican. Gov. Maura Healey and Attorney General Andrea Campbell support the legislation as well.