emoji-picker-react 4.7.16 → 4.7.18
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/emoji-picker-react.cjs.development.js +15 -18
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +15 -18
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useEmojiPreviewEvents.ts +19 -18
package/package.json
CHANGED
|
@@ -87,25 +87,8 @@ export function useEmojiPreviewEvents(
|
|
|
87
87
|
if (button) {
|
|
88
88
|
const belowFoldByPx = detectEmojyPartiallyBelowFold(button, bodyRef);
|
|
89
89
|
const buttonHeight = button.getBoundingClientRect().height;
|
|
90
|
-
if (belowFoldByPx < buttonHeight / 2) {
|
|
91
|
-
const { unified, originalUnified } = allUnifiedFromEmojiElement(
|
|
92
|
-
button
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
if (!unified || !originalUnified) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
setPreviewEmoji({
|
|
100
|
-
unified,
|
|
101
|
-
originalUnified
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
90
|
if (belowFoldByPx < buttonHeight) {
|
|
107
|
-
button
|
|
108
|
-
return;
|
|
91
|
+
return handlePartiallyVisibleElementFocus(button, setPreviewEmoji);
|
|
109
92
|
}
|
|
110
93
|
|
|
111
94
|
focusElement(button);
|
|
@@ -121,3 +104,21 @@ export function useEmojiPreviewEvents(
|
|
|
121
104
|
};
|
|
122
105
|
}, [BodyRef, allow, setPreviewEmoji, isMouseDisallowed, allowMouseMove]);
|
|
123
106
|
}
|
|
107
|
+
|
|
108
|
+
function handlePartiallyVisibleElementFocus(
|
|
109
|
+
button: HTMLElement,
|
|
110
|
+
setPreviewEmoji: React.Dispatch<React.SetStateAction<PreviewEmoji>>
|
|
111
|
+
) {
|
|
112
|
+
const { unified, originalUnified } = allUnifiedFromEmojiElement(button);
|
|
113
|
+
|
|
114
|
+
if (!unified || !originalUnified) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
(document.activeElement as HTMLElement)?.blur?.();
|
|
119
|
+
|
|
120
|
+
setPreviewEmoji({
|
|
121
|
+
unified,
|
|
122
|
+
originalUnified
|
|
123
|
+
});
|
|
124
|
+
}
|