advocates were successful in getting an amendment passed that revoked that law.
This law was passed at a time when stigma against mental illness was much higher than now. I'm guessing it was presumed that folks with a mental illness could not reason enough to exercise an informed vote, which is not true, of course. If 1outta5 have a psychiatric illness, including anxiety, depression, and substance abuse, then there could have been a huge swath of disenfranchised voters.
And there already exists, to a degree, a basic cognitive test for voting -- navigating the whole ballot process. In Maryland, ours was electronic and no harder to use than an iPad, but I could still imaging some with severe dementia unable to navigate the system. But there should never be a cognitive bar one must pass to vote; the challenge would be where you draw the line.