How does an S corp take advantage of 20% QBI deduction?

I understand shareholders of an S corp are eligible to take the 20% QBI deduction. e.g., this. However, at the same time dividends are excluded from QBI deduction e.g., this. so then how can a shareholder of S corp take the QBI deduction since the S corp income will be distributed to the shareholder as a dividend?