I do not know if this is a bug, but as I were to buy a Pickaxe from a Blacksmith villager with Emeralds. But the first page was not to buy it but I didn't think of that and placed out the amount of Emeralds and in his slot the Pickaxe appeared, even though it wasn't the page for that, which was on the next one in this case.
Look at the images I below for a better description.
This works as intended according to Jeb, he stated that a quite long time ago.
You can trade with the villagers if you know what they sell / buy without scrolling to the item.