Neither the keybind nor clicking on the arrow button will cause the GUI to move, you always need to do it from your personal inventory.
I suspect this has to do with how you're doing the check in attached_gui_open (line 216), you probably want to compare against LuaPlayer::opened instead of player.gui.
Read that entry carefully, it does not provide a defines.relative_gui_type, but rather the LuaEntity object itself which has been opened.
It may be easier to entirely remove the attached_gui_open restriction.