Fix clicks on sticker picker buttons to page left/right
This commit is contained in:
parent
2beb421067
commit
6b6da04a65
1 changed files with 12 additions and 1 deletions
|
@ -116,7 +116,18 @@ export const StickerButton = React.memo(
|
|||
setPopperRoot(root);
|
||||
document.body.appendChild(root);
|
||||
const handleOutsideClick = ({ target }: MouseEvent) => {
|
||||
if (!root.contains(target as Node)) {
|
||||
const targetElement = target as HTMLElement;
|
||||
const className = targetElement
|
||||
? targetElement.className || ''
|
||||
: '';
|
||||
|
||||
// We need to special-case sticker picker header buttons, because they can
|
||||
// disappear after being clicked, which breaks the .contains() check below.
|
||||
const isMissingButtonClass =
|
||||
!className ||
|
||||
className.indexOf('module-sticker-picker__header__button') < 0;
|
||||
|
||||
if (!root.contains(targetElement) && isMissingButtonClass) {
|
||||
setOpen(false);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue