+
)
diff --git a/packages/react/src/components/Chat/ChatMessage.tsx b/packages/react/src/components/Chat/ChatMessage.tsx
index cfa9df507d..23acec131b 100644
--- a/packages/react/src/components/Chat/ChatMessage.tsx
+++ b/packages/react/src/components/Chat/ChatMessage.tsx
@@ -17,6 +17,7 @@ import { Ref } from '@fluentui/react-component-ref'
import * as customPropTypes from '@fluentui/react-proptypes'
import cx from 'classnames'
import * as _ from 'lodash'
+import PopperJs from 'popper.js'
import * as PropTypes from 'prop-types'
import * as React from 'react'
// @ts-ignore
@@ -238,12 +239,9 @@ const ChatMessage: React.FC
> &
return actionMenuElement
}
- const menuRect: DOMRect = (positionActionMenu &&
- _.invoke(menuRef.current, 'getBoundingClientRect')) || {
- height: 0,
- }
- const messageRect: DOMRect = (positionActionMenu &&
- _.invoke(messageNode, 'getBoundingClientRect')) || { height: 0 }
+ const messageRect: DOMRect | undefined =
+ positionActionMenu && messageNode?.getBoundingClientRect()
+ const overflowPadding: PopperJs.Padding = { top: Math.round(messageRect?.height || 0) }
return (
> &
// Is required to properly position action items
...(overflow && {
boundariesElement: 'scrollParent',
- escapeWithReference: true,
- padding: { top: messageRect.height - menuRect.height },
+ padding: overflowPadding,
}),
},
}