The HOA is the one violating property rights, that law protects it.
A federal law should prevent a private owner, the HOA from regulating how they chose to run their property and association?