Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:emoji clarification Icon can not work on widget in shadow dom #2240

Merged
merged 3 commits into from Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions packages/botonic-react/src/webchat/components/emoji-picker.jsx
Expand Up @@ -7,13 +7,20 @@ import { ROLES } from '../../constants'
import { useComponentVisible } from '../hooks'
import { Icon, IconContainer } from './common'

export const EmojiPicker = props => (
<IconContainer role={ROLES.EMOJI_PICKER_ICON}>
<div onClick={props.onClick}>
<Icon src={LogoEmoji} />
</div>
</IconContainer>
)
export const EmojiPicker = props =>{
const onClick = event =>{
props.onClick()
event.stopPropagation()
}

return (
<IconContainer role={ROLES.EMOJI_PICKER_ICON}>
<div onClick={onClick}>
<Icon src={LogoEmoji} />
</div>
</IconContainer>
)
}

const Container = styled.div`
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/botonic-react/src/webchat/hooks.js
Expand Up @@ -239,7 +239,7 @@ export function useComponentVisible(initialIsVisible, onClickOutside) {
const [isComponentVisible, setIsComponentVisible] = useState(initialIsVisible)
const ref = useRef(null)
const handleClickOutside = event => {
if (ref.current && !ref.current.contains(event.target)) {
if (ref.current && !ref.current.contains(event.path[0])) {
setIsComponentVisible(false)
onClickOutside()
}
Expand Down