Fix popup position is not correct when space is insufficent at right side