After recent mass shootings, including one in a Walmart in El Paso, Walmart’s chief executive, Doug McMillon, announced that his company would stop selling ammunition for military-style assault rifles, remove handguns from stores in Alaska — the only Walmarts still carrying them — and ask armed people in open-carry states to stay out of its stores.

“It’s clear to us that the status quo is unacceptable,” Mr. McMillon said in a statement.

The leaders of 145 other big American companies , including Levi Strauss, Royal Caribbean Cruises and Bain Capital, published an open letter to the Senate last week pressing for new gun laws, including background checks on all firearms sales and a “ red flag” law to keep guns out of the hands of potentially dangerous individuals.

“Doing nothing about America’s gun violence crisis,” they said, “is simply unacceptable, and it is time to stand with the American public on gun safety.”

On a wide range of issues, including gun safety, environmental sustainability and the treatment of workers, corporations have lately been making a point of doing more than they are required to do by law. In August, the Business Roundtable, a lobby for big companies, replaced its old mission statement, an unapologetic declaration that corporations are in the business of making money, with a softer statement acknowledging “a fundamental commitment to all our stakeholders,” including workers and communities.