When checking whether within a section, need to check all ancestors not just one level up