The deposit sits in a lawyer's or brokerage's trust account, not with the seller, from the moment it is paid until both sides agree, or the Court of King's Bench decides, who it belongs to. Neither party can simply take it based on their own read of the contract.
In a genuine breach, where the buyer had no remaining condition and still refused to close, a seller can pursue keeping the deposit and potentially further damages, though the large majority of disputes settle through negotiation between lawyers long before anyone goes to court.
Joel Dyck writes offers with clear condition deadlines so a dispute over the deposit is far less likely to happen in the first place. Get your hand-reviewed valuation from Joel Dyck.