BEIJING—China is leaving the door open for a trade deal with the U.S., even as it noisily complains about President Trump’s signing of a bill supporting Hong Kong’s anti-Beijing protesters.

Despite harsh language criticizing what Beijing calls U.S. interference in China’s domestic affairs, and a second summoning of the U.S. ambassador in a week, China’s leadership still wants a deal to help alleviate pressure on its fast-weakening economy. Mr. Trump also prefers a deal to boost his re-election bid.

...