The bug
In spectator mode you have the same block and entity reach distance as in survival or adventure mode when you try to open containers.
I would expect it to use the reach distance of creative mode as a higher reach distance gives no gameplay advantage in spectator mode but makes interaction a little bit easier.
How to reproduce
Change your gamemode to creative
Stand in the middle of a block
Use the following command or just place a chest in +x direction manually
/setblock ~1 ~ ~ chestUse the following command
/tp ~-4.4 ~ ~Try to open the chest; it should work
Switch to spectator mode and try to open the chest again
→ ❌ You are unable to open the chest
The reason
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The method net.minecraft.client.multiplayer.PlayerControllerMP.getBlockReachDistance() returns only 4.5 if the player is in creative mode otherwise it returns 4. Additionally the method net.minecraft.client.multiplayer.PlayerControllerMP.extendedReach() is called to test if the player is in creative mode and in that case sets the entity reach distance to 6 (might not be the case anymore in 1.11+).
Confirmed for 1.13.1.