emoji-picker-react 4.4.4 → 4.4.5
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 +29 -26
- 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 +29 -26
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiVariationPicker.tsx +0 -2
- package/src/components/context/ElementRefContext.tsx +5 -0
|
@@ -34,6 +34,31 @@ function asSelectors() {
|
|
|
34
34
|
}).join('');
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function focusElement(element) {
|
|
38
|
+
if (!element) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
requestAnimationFrame(function () {
|
|
43
|
+
element.focus();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function focusPrevElementSibling(element) {
|
|
47
|
+
if (!element) return;
|
|
48
|
+
var prev = element.previousElementSibling;
|
|
49
|
+
focusElement(prev);
|
|
50
|
+
}
|
|
51
|
+
function focusNextElementSibling(element) {
|
|
52
|
+
if (!element) return;
|
|
53
|
+
var next = element.nextElementSibling;
|
|
54
|
+
focusElement(next);
|
|
55
|
+
}
|
|
56
|
+
function focusFirstElementChild(element) {
|
|
57
|
+
if (!element) return;
|
|
58
|
+
var first = element.firstElementChild;
|
|
59
|
+
focusElement(first);
|
|
60
|
+
}
|
|
61
|
+
|
|
37
62
|
function ElementRefContextProvider(_ref) {
|
|
38
63
|
var children = _ref.children;
|
|
39
64
|
var PickerMainRef = useRef(null);
|
|
@@ -78,6 +103,10 @@ function useAnchoredEmojiRef() {
|
|
|
78
103
|
function useSetAnchoredEmojiRef() {
|
|
79
104
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
80
105
|
return function (target) {
|
|
106
|
+
if (target === null && AnchoredEmojiRef.current !== null) {
|
|
107
|
+
focusElement(AnchoredEmojiRef.current);
|
|
108
|
+
}
|
|
109
|
+
|
|
81
110
|
AnchoredEmojiRef.current = target;
|
|
82
111
|
};
|
|
83
112
|
}
|
|
@@ -17852,31 +17881,6 @@ function scrollEmojiAboveLabel(emoji) {
|
|
|
17852
17881
|
scrollBy(scrollBody, -(categoryLabelHeight(closestCategory(emoji)) - by));
|
|
17853
17882
|
}
|
|
17854
17883
|
|
|
17855
|
-
function focusElement(element) {
|
|
17856
|
-
if (!element) {
|
|
17857
|
-
return;
|
|
17858
|
-
}
|
|
17859
|
-
|
|
17860
|
-
requestAnimationFrame(function () {
|
|
17861
|
-
element.focus();
|
|
17862
|
-
});
|
|
17863
|
-
}
|
|
17864
|
-
function focusPrevElementSibling(element) {
|
|
17865
|
-
if (!element) return;
|
|
17866
|
-
var prev = element.previousElementSibling;
|
|
17867
|
-
focusElement(prev);
|
|
17868
|
-
}
|
|
17869
|
-
function focusNextElementSibling(element) {
|
|
17870
|
-
if (!element) return;
|
|
17871
|
-
var next = element.nextElementSibling;
|
|
17872
|
-
focusElement(next);
|
|
17873
|
-
}
|
|
17874
|
-
function focusFirstElementChild(element) {
|
|
17875
|
-
if (!element) return;
|
|
17876
|
-
var first = element.firstElementChild;
|
|
17877
|
-
focusElement(first);
|
|
17878
|
-
}
|
|
17879
|
-
|
|
17880
17884
|
function useFocusSearchInput() {
|
|
17881
17885
|
var SearchInputRef = useSearchInputRef();
|
|
17882
17886
|
return useCallback(function () {
|
|
@@ -18504,7 +18508,6 @@ function EmojiVariationPicker() {
|
|
|
18504
18508
|
var visible = emoji && button && emojiHasVariations(emoji) && button.classList.contains(ClassNames.emojiHasVariatios);
|
|
18505
18509
|
useEffect(function () {
|
|
18506
18510
|
if (!visible) {
|
|
18507
|
-
focusElement(AnchoredEmojiRef.current);
|
|
18508
18511
|
return;
|
|
18509
18512
|
}
|
|
18510
18513
|
|