If the company itself is a party to the Shareholder Agreement then the directors will be bound by the chains of the contract, even if they themselves are not shareholders. At least, you may think this is the logical result. However, what seems the right thing to do at the time can cause a serious headache later.
There is a House of Lords decision (Russell v Northern Bank Development Corp Limited) which says that the company itself cannot be bound by a Shareholder Agreement that tries to restrict the rights that a company would usually enjoy under its Articles of Association.
In other words, restrictions that you create to keep the board of directors in line are likely to be unenforceable.