Modifying a held item via /enchant, /item modify or /loot replace plays the item bob animation if the player is in first-person mode. It is expected that this animation would only play when the attack timer resets or the item is swapped for a different one.
This is a major issue for datapacks which rely on updating a player’s held item, eg. to change an item’s enchantments or enchantment glint, because it suggests to the player that their attack timer has reset even though it hasn’t.
To reproduce
/give @s wooden_sword
Hold the sword
/enchant @s sharpness 2
❌ Notice how the item moved up and down in your hand
Note
The original reporter indicated that previously, an animation would also play in the hotbar, along with the item pick-up sound, however as of at least 25w10a (and probably much earlier) this no longer seems to be the case.
Linked issues
Attachments
Comments 6
By the way the attachment is a json I made for testing, so if you shove it in an empty datapack you can still quickly test for or look at the bug.

My suggestion for fixing this is to never show the item bringing up animation unless the player is
a. scrolling slots,
b. pressing F (offhand swapping), and
c. repairing damaged items using the mending enchantment.
And... The glitch is even worse than I thought... I usually don't play with sound but when I did it made this aweful buzz each time someone held an item to be replaced, with both versions 1.16.4 and with the new item command in 1.17 snapshots

As of 25w10a I don’t get the sound, just the animation, which is the main issue (because players often assume that the item bob animation is tied to the attack timer).

And armors make the equip sound too, Idk if it’s normal, but it’s ennoying if we want to change always the items
Confirmed for 20w48a