CCC 1736 Every act directly willed is imputable to its author:
Thus the Lord asked Eve after the sin in the garden: “What is this that you have done?”1 He asked Cain the same question.2 The prophet Nathan questioned David in the same way after he committed adultery with the wife of Uriah and had him murdered.3
An action can be indirectly voluntary when it results from negligence regarding something one should have known or done: for example, an accident arising from ignorance of traffic laws.
1 Gen 3:13.
2 Cf. Gen 4:10.
3 Cf. 2 Sam 12:7-15.