antd-mobile 5.41.0 → 5.41.1-alpha.1
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/2x/bundle/antd-mobile.cjs.development.js +4 -1
- package/2x/bundle/antd-mobile.cjs.js +4 -4
- package/2x/bundle/antd-mobile.es.development.js +4 -1
- package/2x/bundle/antd-mobile.es.js +655 -655
- package/2x/bundle/antd-mobile.umd.development.js +4 -1
- package/2x/bundle/antd-mobile.umd.js +4 -4
- package/2x/cjs/components/tabs/tabs.js +5 -1
- package/2x/es/components/tabs/tabs.js +5 -1
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +4 -1
- package/bundle/antd-mobile.cjs.js +4 -4
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +4 -1
- package/bundle/antd-mobile.es.js +655 -655
- package/bundle/antd-mobile.umd.development.js +4 -1
- package/bundle/antd-mobile.umd.js +4 -4
- package/cjs/components/tabs/tabs.js +5 -1
- package/es/components/tabs/tabs.js +5 -1
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -59,6 +59,8 @@ const Tabs = p => {
|
|
|
59
59
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
+
/** Save the keyboard click to make sure focus only trigger when by keyboard */
|
|
63
|
+
const manuallyActiveRef = (0, _react.useRef)(null);
|
|
62
64
|
const [{
|
|
63
65
|
x,
|
|
64
66
|
width
|
|
@@ -227,13 +229,15 @@ const Tabs = p => {
|
|
|
227
229
|
const currentKey = findNextEnabledTab(currentIndex, offsetDirection);
|
|
228
230
|
if (isNext || isPrev) {
|
|
229
231
|
e.preventDefault();
|
|
232
|
+
manuallyActiveRef.current = currentKey;
|
|
230
233
|
setActiveKey(currentKey);
|
|
231
234
|
}
|
|
232
235
|
};
|
|
233
236
|
(0, _react.useEffect)(() => {
|
|
234
237
|
var _a;
|
|
235
|
-
if (activeKey && tabRefs.current[activeKey]) {
|
|
238
|
+
if (activeKey && tabRefs.current[activeKey] && manuallyActiveRef.current === activeKey) {
|
|
236
239
|
(_a = tabRefs.current[activeKey]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
240
|
+
manuallyActiveRef.current = null;
|
|
237
241
|
}
|
|
238
242
|
}, [activeKey]);
|
|
239
243
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
@@ -49,6 +49,8 @@ export const Tabs = p => {
|
|
|
49
49
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
+
/** Save the keyboard click to make sure focus only trigger when by keyboard */
|
|
53
|
+
const manuallyActiveRef = useRef(null);
|
|
52
54
|
const [{
|
|
53
55
|
x,
|
|
54
56
|
width
|
|
@@ -217,13 +219,15 @@ export const Tabs = p => {
|
|
|
217
219
|
const currentKey = findNextEnabledTab(currentIndex, offsetDirection);
|
|
218
220
|
if (isNext || isPrev) {
|
|
219
221
|
e.preventDefault();
|
|
222
|
+
manuallyActiveRef.current = currentKey;
|
|
220
223
|
setActiveKey(currentKey);
|
|
221
224
|
}
|
|
222
225
|
};
|
|
223
226
|
useEffect(() => {
|
|
224
227
|
var _a;
|
|
225
|
-
if (activeKey && tabRefs.current[activeKey]) {
|
|
228
|
+
if (activeKey && tabRefs.current[activeKey] && manuallyActiveRef.current === activeKey) {
|
|
226
229
|
(_a = tabRefs.current[activeKey]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
230
|
+
manuallyActiveRef.current = null;
|
|
227
231
|
}
|
|
228
232
|
}, [activeKey]);
|
|
229
233
|
return withNativeProps(props, React.createElement("div", {
|