Now, though, Yahoo has made a surprise move: abolishing its work-at-home policy and ordering everyone to work in the office.

A memo explaining the policy change, from the company’s human resources department, says face-to-face interaction among employees fosters a more collaborative culture — a hallmark of Google’s approach to its business.

In trying to get back on track, Yahoo is taking on one of the country’s biggest workplace issues: whether the ability to work from home, and other flexible arrangements, leads to greater productivity or inhibits innovation and collaboration.

Across the country, companies like Aetna, Booz Allen Hamilton, and Zappos.com are confronting these trade-offs as they compete to attract and retain the best employees.

Bank of America, for example, which had a popular program for working remotely, decided late last year to require employees in certain roles to come back to the office.

Employees, especially younger ones, expect to be able to work remotely, analysts say. And overall the trend is toward greater workplace flexibility.

Still, said John Challenger, chief executive of Challenger Gray & Christmas, an outplacement and executive coaching firm, ‘‘A lot of companies are afraid to let their workers work from home some of the time or all of the time because they’re afraid they’ll lose control.’’

Reflecting these tensions, Yahoo’s policy change has unleashed a storm of criticism from advocates for workplace flexibility who say it is a retrograde approach, particularly for those who care for young children or aging parents outside of work.

Their dismay is heightened by the fact that they hoped Mayer, who became chief executive at 37 while pregnant with her first child, would make the business world more hospitable for working parents.

“The irony is that she has broken the glass ceiling, but seems unwilling for other women to lead a balanced life in which they care for their families and still concentrate on developing their skills and career,’’ said Ruth Rosen, a professor emerita of women’s history at the University of California.

But not only women take advantage of workplace flexibility policies. According to the Bureau of Labor Statistics, nearly as many men telecommute.

A Yahoo spokeswoman, Sara Gorman, declined to comment, saying only that the company did not publicly discuss internal matters.

In part, the memo looks like an effort to bring a Google spirit to Yahoo, said Colin Gillis, an analyst at BGC Partners who covers both companies.

‘‘Marissa’s trying to increase the energy and output and change the culture of the company,’’ he said. ‘‘She brings all the Google lessons to the table, and Google is very focused on having your life revolve around their campus so you can spend a significantly larger chunk of time at work,’’ he added.

Still, Google, as well as Facebook, does allow people to work remotely on a case-by-case basis. But both companies also strongly stress in-person collaboration.