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
|
@@ -40,6 +40,31 @@ function asSelectors() {
|
|
|
40
40
|
}).join('');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function focusElement(element) {
|
|
44
|
+
if (!element) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
requestAnimationFrame(function () {
|
|
49
|
+
element.focus();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function focusPrevElementSibling(element) {
|
|
53
|
+
if (!element) return;
|
|
54
|
+
var prev = element.previousElementSibling;
|
|
55
|
+
focusElement(prev);
|
|
56
|
+
}
|
|
57
|
+
function focusNextElementSibling(element) {
|
|
58
|
+
if (!element) return;
|
|
59
|
+
var next = element.nextElementSibling;
|
|
60
|
+
focusElement(next);
|
|
61
|
+
}
|
|
62
|
+
function focusFirstElementChild(element) {
|
|
63
|
+
if (!element) return;
|
|
64
|
+
var first = element.firstElementChild;
|
|
65
|
+
focusElement(first);
|
|
66
|
+
}
|
|
67
|
+
|
|
43
68
|
function ElementRefContextProvider(_ref) {
|
|
44
69
|
var children = _ref.children;
|
|
45
70
|
var PickerMainRef = React.useRef(null);
|
|
@@ -84,6 +109,10 @@ function useAnchoredEmojiRef() {
|
|
|
84
109
|
function useSetAnchoredEmojiRef() {
|
|
85
110
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
86
111
|
return function (target) {
|
|
112
|
+
if (target === null && AnchoredEmojiRef.current !== null) {
|
|
113
|
+
focusElement(AnchoredEmojiRef.current);
|
|
114
|
+
}
|
|
115
|
+
|
|
87
116
|
AnchoredEmojiRef.current = target;
|
|
88
117
|
};
|
|
89
118
|
}
|
|
@@ -17846,31 +17875,6 @@ function scrollEmojiAboveLabel(emoji) {
|
|
|
17846
17875
|
scrollBy(scrollBody, -(categoryLabelHeight(closestCategory(emoji)) - by));
|
|
17847
17876
|
}
|
|
17848
17877
|
|
|
17849
|
-
function focusElement(element) {
|
|
17850
|
-
if (!element) {
|
|
17851
|
-
return;
|
|
17852
|
-
}
|
|
17853
|
-
|
|
17854
|
-
requestAnimationFrame(function () {
|
|
17855
|
-
element.focus();
|
|
17856
|
-
});
|
|
17857
|
-
}
|
|
17858
|
-
function focusPrevElementSibling(element) {
|
|
17859
|
-
if (!element) return;
|
|
17860
|
-
var prev = element.previousElementSibling;
|
|
17861
|
-
focusElement(prev);
|
|
17862
|
-
}
|
|
17863
|
-
function focusNextElementSibling(element) {
|
|
17864
|
-
if (!element) return;
|
|
17865
|
-
var next = element.nextElementSibling;
|
|
17866
|
-
focusElement(next);
|
|
17867
|
-
}
|
|
17868
|
-
function focusFirstElementChild(element) {
|
|
17869
|
-
if (!element) return;
|
|
17870
|
-
var first = element.firstElementChild;
|
|
17871
|
-
focusElement(first);
|
|
17872
|
-
}
|
|
17873
|
-
|
|
17874
17878
|
function useFocusSearchInput() {
|
|
17875
17879
|
var SearchInputRef = useSearchInputRef();
|
|
17876
17880
|
return React.useCallback(function () {
|
|
@@ -18459,7 +18463,6 @@ function EmojiVariationPicker() {
|
|
|
18459
18463
|
var visible = emoji && button && emojiHasVariations(emoji) && button.classList.contains(ClassNames.emojiHasVariatios);
|
|
18460
18464
|
React.useEffect(function () {
|
|
18461
18465
|
if (!visible) {
|
|
18462
|
-
focusElement(AnchoredEmojiRef.current);
|
|
18463
18466
|
return;
|
|
18464
18467
|
}
|
|
18465
18468
|
|