I haven't tested this on any other version, but in 1.13, the mending enchant prioritizes armor over everything even when fully repaired. I can go mining with my armor fully repaired but it doesn't repair my pickax (or anything that I am holding that has mending) until I take off my armor.
Environment
Full mending armor
Get a mending tool
Make sure armor is fully repaired
Get XP from somewhere and hold the broken tool for the XP to repair
Notice the tool health bar does not go up
Do the same thing but without the armor on
The tool health bar goes up
Not a bug, mending randomly chooses between your main hand, offhand, and the armor slots. If the selected item is fully repaired it will add the XP to your XP bar rather than reselecting the item.
https://minecraft.gamepedia.com/Enchanting#Mending