WASHINGTON—Federal judges would have to speed disclosure of stock trades and publish their financial-disclosure reports online for the first time under a bipartisan bill overwhelmingly passed by the U.S. House Wednesday.

Democrats and Republicans championed the legislation after articles in The Wall Street Journal found hundreds of lawsuits were overseen by judges involving corporate litigants in which the judges themselves or their families had an ownership stake.

“This common-sense, bipartisan legislation would serve to fill a transparency void that plagues our current federal judicial system, as recently exposed by The Wall Street Journal in a series of reports,” said Rep. Deborah Ross (D., N.C.), who introduced the bill. “Per those reports, 131 federal judges broke the law by hearing cases where they had a financial interest.”

Passed by a vote of 422-4, the House bill would require judges to disclose stock trades worth more than $1,000 within 45 days, as already required for members of Congress and senior executive-branch officials.

It also would require the judiciary to post both the stock-trade reports and annual disclosure-reports forms online within 90 days of being filed. Currently, annual reports aren’t due until May of the following reporting year and periodic stock-trade reports aren’t required at all.

The bill also would require the judges to create a searchable online database to enable public access to the disclosures.

The bill mirrors legislation drafted by Sen. John Cornyn (R., Texas) and co-sponsored by Sen. Chris Coons (D., Del.), pending before a U.S. Senate committee.

The Judicial Conference, which represents judges on policy matters, hasn’t taken a formal position on the bill, a spokesman said. However, the judges’ lobbyists have privately told lawmakers the law could take two years to implement and judges are worried about the costs of running the online database, according to people briefed on the discussions.

Rep. Darrell Issa (R., Calif.), a co-sponsor of the bill, praised his colleagues who “quite frankly pushed against the members of the court who have not yet supported this, who somehow believe these are exceptions and these exceptions are not sufficient to put the mandate on the third branch of government required on the first two.”

Financial disclosures rarely become public, are cumbersome to request and often take months or years to be released. The names of requesters to see the forms were shared with the judges, creating a deterrent for litigants and lawyers afraid of irritating the judge overseeing their litigation.

“The infrequency of judges’ financial disclosures and the inaccessibility of the reports themselves have made actual transparency practically impossible,” said Jerrold Nadler (D., N.Y.), chairman of the House Judiciary Committee.

In September the Journal reported that more than 130 judges failed to recuse themselves in 685 cases despite having financial conflicts from 2010 through 2018. The Journal’s initial tally of recusal violations was an undercount. After being contacted by the Journal, 70 of those judges directed court clerks to notify parties in more than 700 lawsuits that they owned shares of various litigants.

Nearly 190 of the notices filed were in cases outside the Journal’s analysis, indicating that failures to recuse by judges may be more widespread. Parties who received the notices can ask courts to reopen their cases and have them heard by a new judge.

Peter Kraus, who tried a case before a federal judge who was a subject of the Journal investigation, said if he had been able to see the judge’s financial disclosures, his lawsuit might have ended differently.

In an email, Mr. Kraus said that under the proposed law, “lawyers will be able to confirm no conflict exists without antagonizing the courts by requesting financial disclosure forms from the Judges.”