Abstract commensurators of right-angled Artin groups and mapping class groups