antd-mobile 5.41.1-alpha.0 → 5.41.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", {
|
package/2x/package.json
CHANGED
|
@@ -12285,6 +12285,7 @@ const Tabs$1 = (p) => {
|
|
|
12285
12285
|
(_a2 = props.onChange) === null || _a2 === void 0 ? void 0 : _a2.call(props, v);
|
|
12286
12286
|
}
|
|
12287
12287
|
});
|
|
12288
|
+
const manuallyActiveRef = React$3.useRef(null);
|
|
12288
12289
|
const [{
|
|
12289
12290
|
x,
|
|
12290
12291
|
width
|
|
@@ -12445,13 +12446,15 @@ const Tabs$1 = (p) => {
|
|
|
12445
12446
|
const currentKey = findNextEnabledTab(currentIndex, offsetDirection);
|
|
12446
12447
|
if (isNext || isPrev) {
|
|
12447
12448
|
e2.preventDefault();
|
|
12449
|
+
manuallyActiveRef.current = currentKey;
|
|
12448
12450
|
setActiveKey(currentKey);
|
|
12449
12451
|
}
|
|
12450
12452
|
};
|
|
12451
12453
|
React$3.useEffect(() => {
|
|
12452
12454
|
var _a2;
|
|
12453
|
-
if (activeKey && tabRefs.current[activeKey]) {
|
|
12455
|
+
if (activeKey && tabRefs.current[activeKey] && manuallyActiveRef.current === activeKey) {
|
|
12454
12456
|
(_a2 = tabRefs.current[activeKey]) === null || _a2 === void 0 ? void 0 : _a2.focus();
|
|
12457
|
+
manuallyActiveRef.current = null;
|
|
12455
12458
|
}
|
|
12456
12459
|
}, [activeKey]);
|
|
12457
12460
|
return withNativeProps(props, React$3.createElement("div", {
|