backported stateChangeError's preventDefault feature