@landtrustinc/design-system 1.2.27-beta.4 → 1.2.27-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5957,10 +5957,14 @@ var ChatWidget = import_react30.default.forwardRef(
5957
5957
  () => ({
5958
5958
  scrollToMessageIndex: (index) => {
5959
5959
  const messageEl = messageRefs.current[index];
5960
- if (messageEl && scrollRef.current && isExpanded) {
5960
+ const container = scrollRef.current;
5961
+ if (messageEl && container && isExpanded) {
5961
5962
  requestAnimationFrame(() => {
5962
- scrollRef.current.scrollTop = messageEl.offsetTop;
5963
- savedScrollPosition.current = messageEl.offsetTop;
5963
+ const containerRect = container.getBoundingClientRect();
5964
+ const messageRect = messageEl.getBoundingClientRect();
5965
+ const scrollAmount = container.scrollTop + (messageRect.top - containerRect.top);
5966
+ container.scrollTop = scrollAmount;
5967
+ savedScrollPosition.current = scrollAmount;
5964
5968
  });
5965
5969
  }
5966
5970
  }