The game accepts an animal-targeted interaction packet (the one used for horses and llamas) when it is aimed at a villager. If the villager is holding out an item for a trade, the packet triggers the item to be dropped
Expected result:
No item should be dropped when clicking holding shears on villager
To reproduce this, you need to:
Find a villager that is holding out one of the following items for a trade: a carpet, a saddle, or horse armor.
Hold the emeralds in hand. While the villager is still holding the item out, quickly switch holding item to shears and right-click on villager.
The villager drops the held item toward the player, and its trades are not affected.
Affected items: carpets, saddle, horse armor.
Video containing the bug reproduction