refactor auto-scroll-to-end of parent of msg template