Hopper stays in "glued to wall" position even if the block next to it was removed, and stays in the "unglued to wall" position after placing a block next to it. The only way to update the graphics is to break and re-place the hopper.
Note: I used the search button to make sure it's not a duplicate.
Hoppers will point to the block you placed it on. This is intended, they do not automatically point to chests and other inventories.