The bug
When a player "uses" an item (or performs any other right-click action), the player is put into attack cooldown, as though the player had just attacked. On top of being unintended behavior, this cooldown is not visually indicated: the item in the main hand does not move down, and the attack indicator does not appear. Should the player attack right after a "use" action, the weapon will look like it's doing a normal attack, but will suffer all the penalties of being on cooldown, e.g. reduced damage, no sweeping hit, no crit.
How to reproduce
Put a sword in the main hand, a fishing rod in the offhand, and a mob in front of you. Use the rod, then immediately swing. There's no sweeping attack, and the mob will take less damage.
This bug interferes with common combat scenarios such as:
-Pulling a shield up to block just before attacking
-Placing blocks/water/lava from offhand then attacking
-Throwing a projectile from offhand then attacking
-Launching self with a wind charge before attacking
Linked issues
is duplicated by 7
Attachments
Comments 19
Relates to MC-116510.
Oh and still affects 1.12.1.

Added, but since you're the reporter of this bug you can update the affected versions directly.
Affects 1.16 pre release 2
Can confirm in 1.19.
Can confirm in 1.19.3.
Can confirm in 1.20.2.

This bug also affects throwing wind charges. As of 24w18a, it's impossible to crit with a mace after using a wind charge, and if MC-270158 is fixed, this bug will prevent players from using wind burst after using a wind charge

Still works in version 1.21.5
Sometimes I cannot protect myself from a zombie using a shield. :(
How does this duplicate switching weapons? This has nothing to do with switching what weapon a player is holding - using an item resets the cooldown. If you hold something in the offhand and right-click to use it, the main hand weapon has its cooldown activated.