When trapping villagers in a house (in a 1x1 enclosure), the trade menu will not stay open. When right clicked, the menu will open then immediately close itself. in one case, after breaking the blocks obstructing the villager, the menu bug was fixed. However this does not work immediately.
Related issues
duplicates
Comments

Duplicate of MC-154201.