OF ALL the revelations brought about by the #MeToo movement, none was more stunning — or more galling — than the fact that U.S. taxpayers had repeatedly financed the settlement of sexual harassment and other misconduct charges brought against members of Congress and their Capitol Hill staffs. Established under a 1995 statute intended to require lawmakers to follow the statutes they write, Congress’s Office of Compliance paid out $17 million between 1997 and 2017. Notable cases included an $84,000 payment to a victim of alleged sexual harassment by then- Rep. Blake Farenthold (R-Tex.) and $27,000 to a woman who complained that then-Rep. John Conyers Jr. (D-Mich.) had fired her after she refused his advances and requests for sexual favors. Complainants in all such cases were required to keep the matters confidential as a condition of receiving compensation.

Now, after various harassment scandals that cost Mr. Farenthold and Mr. Conyers, and other members of Congress, their seats in the past two years, Congress has reformed its procedures. Under legislation passed Dec. 13, members of the House and Senate will have to reimburse the Treasury for all future payments to settle sexual harassment claims. Sponsored by Sens. Amy Klobuchar (D-Minn.) and Roy Blunt (R-Mo.) and Reps. Jackie Speier (D-Calif.) and Bradley Byrne (R-Ala.), the bill requires the Office of Compliance to publish an annual report of all settlements and awards and eliminates mandatory confidentiality agreements for accusers. The new law would also end the current requirement that accusers accept up to 90 days of counseling, mediation and “cooling off” periods before lodging formal complaints.

This is a major, if belated, step in the right direction, more welcome for the fact that it is the product of an apparently robust, good-faith bipartisan negotiation. Having been approved by unanimous consent in both houses, the legislation received President Trump’s signature on Dec. 21, which was expected but, given his record, one of the more remarkable ironies of recent political history. Still, we’ll take this victory for gender equality and accountability any way we can get it.

Unfinished business remains. The new law applies only to sexual harassment charges, not to cases of alleged discrimination — such as denying a job to a woman because she may become pregnant. In those situations, the old rules apparently still apply, for no good reason we can think of. Whatever complexities stood in the way of adding that final crucial provision to Capitol Hill’s post-#MeToo rules ought to be addressed promptly after the new Congress arrives in January.