Help me identify strange dog behavior

Our elderly spaniel used to go out in the front yard (trundling down the sidewalk which was adjacent to a low fence). Then when it was time to come back in, she’d walk up to the fence and look puzzled that her path was blocked, not realizing that all she had to do was retrace her steps up the walk).

This happened over the last couple years or so of her life. I think she was mildly dotty but not actually demented.