Intercept anchor clicks that should trigger a state change