Merge "Avoid detached surface from returning to hierarchy" into main