Supporters of a ban on confidential settlements say they allow harassers and abusers to prey on others who have no warning . But someone who has been assaulted or harassed may want to keep the details private, or they might be willing to do so if it helps them get a meaningful settlement , something that could help them move on . And a harasser may not be willing to settle if he knows the deal may become public.

In some states where bills were seriously considered, bar associations and business groups have lobbied against them. The California Chamber of Commerce opposed the bill that was eventually passed in that state, saying it would force companies to go to trial to “preserve their public image.”

The New Jersey State Bar Association was a vocal opponent of the bill there.

“It’s not popular for any business, or bar association for that matter, to take what could be perceived as a stand against a sex harassment or sexual assault victim,” said Christine A. Amalfe, a former trustee of the state bar who helped draft its position on the bill.

Nonetheless, she said, “this law in New Jersey appears to be a bit of an overreaction to what MeToo was really about.” Ms. Amalfe said that New Jersey’s new law will hurt victims because defendants will be more likely to fight allegations in court if they know the accusations could become public anyway.

Nondisclosure agreements are common in the legal world and in business, where entrepreneurs make workers sign them to protect ideas and corporate plans. Celebrities use them with employees in an effort to maintain some privacy. An N.D.A. cannot stop a victim from cooperating with a police investigation, but generally, once a deal is reached, that is where the talking stops.

The legislative proposals around the country have been targeted at the use of N.D.A.'s in cases of sexual misconduct. So far, most of the bills that have passed have placed restrictions on these agreements, without banning or neutralizing them.