Fixes UI glitch when selecting a photo. Based on @Evrst commit.