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