remove temp element when determining selection position