When you use tools with unbreaking enchantment, their durability may drop randomly, and in certain circumstances the durability bar appears or changes its look. For example, the durability bar of a full-durability tool item should only appear when its durability actually drops. However, sometimes when a tool is used, the durability bar appears (becomes shorter) and then instantly disappears (becomes longer), and its in-game durability remains actually unchanged (checked by using "/clear" command).
The attachment shows one instance of the bug. To reproduce it:
Get any tool and enchant it with the unbreaking enchantment (any level is OK).
Use it in Survival mode for several times, the bug may occur randomly.
Note: The best way to reproduce the bug is to get several enchanted tool with full durability and use all of them. At least one of them should show how the durability bar appears and disappears.
Can confirm, affects 1.20.51.
From my tests, applying Efficiency V and Unbreaking III to a golden or wooden shovel is the best way to trigger the glitch.
Updated description of the bug: Whenever you enchant a tool (shovel) with any level of unbreaking; mining or breaking any blocks with said tool, will occasionally cause the durability meter to glitch out, causing the tool to visually gain or lose durability.
Observed results:
The durability meter will occasionally fluctuate between gaining or losing durability.
Expected results:
The durability meter should constantly decrease (unless mending is applied).
Closely observe the durability meter in the attached video: