When you look up or down on a ladder you can't attack or use that animation in the air. I f you stare at something it works but it doesn't always happen just like an 80% chance.
Related issues
is duplicated by
Comments

Ender Dragon thats mainly all it is
Can confirm. You might want to change the title to something more clear like "Unable to attack on ladder facing up or down"

Is this still an issue in 15w45a? If so, please explain the issue in detail and provide steps to reproduce it. Please also update the list of affected versions.
Steps to Reproduce:
Go on a ladder, preferably the middle
Get a sword
Look straight down or straight up
Try swinging your sword
Can confirm for 15w45a

Duplicates MC-79925
Confirmed for 15w51b

Still in 1.9.4

Resolving as a duplicate of MC-79925 - these are both the same issue, it's just that this is what happens when there is a null hitResult.
Can you please give a clearer explanation?