(Recasts, adds detail, Beijing government)
BEIJING, Feb 25 (Reuters) - Chinese President Xi Jinping surprised Beijing residents by visiting traditional courtyard homes and chatting near a shopping street on Tuesday, drawing praise from social media for mixing in public during a bad bout of smog.
Unscripted interactions between politicians and the public are uncommon in a country where even leaders' birthdays and family backgrounds are often closely held secrets.
A shaky video of Xi's visit posted online showed people applauding him as he approached. He stopped to ask residents how long they've lived in the neighbourhood before ambling away.
Photographs posted online by media showed Xi mobbed by people holding cameras and cell phones as he stood grinning in an alley in Beijing's historic old quarter.
The area, frequented by young Chinese and tourists alike, is lined with stands selling street snacks like octopus balls and red bean cakes, as well as clothing and souvenir stores.
Xi was accompanied by Beijing Mayor Wang Anshun, apparently in a bid to dispel speculation in overseas Chinese media that Wang has been implicated in a corruption investigation into retired former domestic security chief Zhou Yongkang.
Xi's few forays into public settings have attracted widespread praise.
He surprised customers at a steamed bun shop in December when he turned up, paid for his own food, carried his own tray and chatted with fellow diners.
Smog has been thick for the past few days in Beijing and many internet users expressed approval that the president was exposing himself to the same air as everyone else without donning a mask.
"Breathe the same air and share the same fate," the Beijing city government said on its official Weibo microblog, in a widely shared post. (Reporting By Megha Rajagopalan; Additional reportin by Benjamin Kang Lim and Ben Blanchard; Editing by Michael Perry and Robert Birsel)