While holding the sneak button, opening and closing the inventory will go out of sneak mode.
Steps to repoduce:
1. Hold down the sneak key (shift)
2. Open inventory (press E)
3 Do something in the inventory (optional)
4. Close the inventory (press E)
5. Although you are still holding your sneak key, you will walk normally and fall of a ledge.
Currently, you have to press sneak again everytime you close the inventory, but this is easily forgotten.
Especially when working on complicated build projects in great heights, it is often necessary to simultaneously
(1) Sneak all the time
(2) Switch items in and out of your hotbar
Not having to press sneak again would smooth out this workflow and make the build process more secure.