diff --git a/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx b/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx index daae69230..26f8d93b2 100644 --- a/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx +++ b/packages/bot-engine/src/components/ChatBlock/ChatBlock.tsx @@ -74,6 +74,7 @@ export const ChatBlock = ({ } const displayNextStep = (answerContent?: string, isRetry?: boolean) => { + onScroll() const currentStep = [...displayedSteps].pop() if (currentStep) { if (isRetry && stepCanBeRetried(currentStep)) diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/ImageBubble.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/ImageBubble.tsx index 8df1bb871..5410e86c6 100644 --- a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/ImageBubble.tsx +++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/ImageBubble.tsx @@ -27,6 +27,7 @@ export const ImageBubble = ({ step, onTransitionEnd }: Props) => { ) useEffect(() => { + sendAvatarOffset() showContentAfterMediaLoad() // eslint-disable-next-line react-hooks/exhaustive-deps }, []) @@ -55,7 +56,9 @@ export const ImageBubble = ({ step, onTransitionEnd }: Props) => { const sendAvatarOffset = () => { if (!messageContainer.current) return const containerDimensions = messageContainer.current.getBoundingClientRect() - updateLastAvatarOffset(containerDimensions.top + containerDimensions.height) + updateLastAvatarOffset( + messageContainer.current.offsetTop + containerDimensions.height + ) } return ( diff --git a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/VideoBubble.tsx b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/VideoBubble.tsx index 17fcb3ec8..d12a5a9d4 100644 --- a/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/VideoBubble.tsx +++ b/packages/bot-engine/src/components/ChatBlock/ChatStep/bubbles/VideoBubble.tsx @@ -26,6 +26,7 @@ export const VideoBubble = ({ step, onTransitionEnd }: Props) => { const [isTyping, setIsTyping] = useState(true) useEffect(() => { + sendAvatarOffset() showContentAfterMediaLoad() // eslint-disable-next-line react-hooks/exhaustive-deps }, []) @@ -48,7 +49,9 @@ export const VideoBubble = ({ step, onTransitionEnd }: Props) => { const sendAvatarOffset = () => { if (!messageContainer.current) return const containerDimensions = messageContainer.current.getBoundingClientRect() - updateLastAvatarOffset(containerDimensions.top + containerDimensions.height) + updateLastAvatarOffset( + messageContainer.current.offsetTop + containerDimensions.height + ) } return (