...illegal, but with a loophole you can drive a truck through: if the employer thinks your project is close enough to what they do (or might one day do) it’s theirs. Beware!
But they have to prove this to a judge. The onus is now on them to prove that the thing is related enough to keep you from feeding your family.
I agree, but it’s you vs 500 lawyers. The company can afford litigation, can you?
Many believe this is one of the reasons Silicon Valley became what it is.