Shanghai officials have constructed fences around housing complexes to curb a COVID-19 outbreak, stirring up uproar over a lockdown that has forced many of the city's 25 million people to stay indoors.

The country's most populous metropolis and most vital economic powerhouse is combating the country's largest COVID-19 outbreak by shutting down portions of the city and putting all people who test positive into quarantine facilities.

The Shanghai lockdown, which has stretched more than three weeks for several locals, has fueled public outrage over lost income, family separations, inadequate quarantine facilities, and a shortage of healthcare and food.

On Sunday, China confirmed 21,796 new community-transmitted COVID-19 cases, the great majority of which were asymptomatic.

Since the outbreak began over two months ago, hundreds of thousands of infections have been documented in Shanghai, but fewer than 100 casualties have occurred because of the extremely contagious Omicron variety.

Photos of government personnel in hazmat suits sealing up entries to residential buildings in the city and closing entire streets with green netting have gone popular on social media, raising inquiries and protests from locals.

"Using metal bars to contain them like domesticated animals is very insulting of the citizen's rights inside," a member of the social media site Weibo remarked.

Residents shouted from balconies at workmen attempting to erect fencing before relenting and removing the blockade, as per one video. Other recordings revealed individuals attempting to tear down the barriers.

Many of the barriers have been built surrounding "sealed areas," which are residential homes where at least one individual has tested positive for COVID-19, making it illegal for anyone inside to leave their front doors.

"Hard quarantine" was implemented in some locations, according to a notification posted online on Saturday, allegedly from a local government.

A request for a response from the Shanghai authorities was not returned.

Shanghai's lockdown has had a negative impact on China's economy, with knotted supply chains disrupting manufacturing operations and inhabitants having difficulty going back to work.

Many locals have gone to the internet to express their dissatisfaction with the lockdown, but they are fighting government censors with euphemisms and other tactics.

Days after the initial outbreak in Wuhan in late 2019, China generally managed to keep COVID-19 at bay by implementing a "dynamic zero" policy targeted at breaking infection networks.

The development of the highly contagious but less lethal Omicron form has thrown this method into doubt, prompting towns to adopt various kinds of movement restrictions.