Hitting a mob while swimming makes you stop swimming
What I expected to happen was...:
Keep swimming
What actually happened was...:
Hit the mob causes stop the swimming
Steps to Reproduce:
1. Stay underwater where have a mob;
2. Start swimming (Ctrl + w)
3. Hit an mob (squid, fish, even a pig...) while swimming;
4. The bug appears here.
Linked issues
Comments

I translate the issue to English now.
Can confirm, it fully happens if you keep holding W (Walk Forwards) while not holding left ctrl (which will stop you from swimming briefly and then go back to swimming mode).
Can confirm for 1.16.3rc1
Can confirm in 20w51a.
Can confirm in 21w03a.
Can confirm in 1.16.5 and 21w08b.
Isn't this a duplicate of MC-129568?
I searched a lot but didn't find anything similar.
But this is a duplicate.
Thank you for your report!
However, this issue is Invalid.
Bug reports are only accepted in English, sorry.
Feel free to create a new report if you can speak English.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki