When switching to spectator mode, it takes a bit to register that you are actually in spectator mode rather than instantly. You have to cross a chunk border to fully register the gamemode change.
Steps to Reproduce:
Equip an elytra
Set the gamerule spectatorsGenerateChunks to false
Make sure you are in the middle of a chunk (including vertical chunk)
Enter fly mode then use the f3+n hotkey to switch to spectator mode
❌ You enter a weird mode until you cross a chunk border
Can’t seem to reproduce this; possibly it’s caused by something else