@via-profit/ui-kit 0.10.0 → 0.10.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/CHANGELOG.md +6 -0
- package/DatePicker/index.js +3 -1
- package/HintPopover/index.js +1 -1
- package/Menu/MenuContainer.js +5 -3
- package/Selectbox/SelectboxMenu.js +1 -1
- package/esm/DatePicker/index.js +3 -1
- package/esm/HintPopover/index.js +1 -1
- package/esm/Menu/MenuContainer.js +5 -3
- package/esm/Selectbox/SelectboxMenu.js +1 -1
- package/esm/utils/TabManager.js +1 -1
- package/package.json +1 -1
- package/utils/TabManager.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## Не выпущено
|
|
6
6
|
|
|
7
|
+
## 0.10.1 — 2026-10-23
|
|
8
|
+
|
|
9
|
+
### Исправлено
|
|
10
|
+
|
|
11
|
+
- **Menu**, **Selectbox**, **DatePicker**, **HintPopover**, модальные окна: возвращая фокус на кнопку или поле после закрытия, кит больше не прокручивает страницу (`focus({ preventScroll: true })`). Если кнопка-якорь стоит в закреплённой шапке (`position: sticky`), Chrome прокручивал страницу к исходному месту шапки в документе, и после закрытия меню щелчком мимо страница прыгала. Список Menu при открытии тоже получает фокус без прокрутки.
|
|
12
|
+
|
|
7
13
|
## 0.10.0 — 2026-10-21
|
|
8
14
|
|
|
9
15
|
### Добавлено
|
package/DatePicker/index.js
CHANGED
|
@@ -130,7 +130,9 @@ const DatePicker = props => {
|
|
|
130
130
|
var _a, _b;
|
|
131
131
|
setOpenSate(false);
|
|
132
132
|
// Back to the field, so the keyboard user continues from the same place
|
|
133
|
-
(_b = (readOnly ? inputRef.current : ((_a = buttonRef.current) !== null && _a !== void 0 ? _a : inputRef.current))) === null || _b === void 0 ? void 0 : _b.focus(
|
|
133
|
+
(_b = (readOnly ? inputRef.current : ((_a = buttonRef.current) !== null && _a !== void 0 ? _a : inputRef.current))) === null || _b === void 0 ? void 0 : _b.focus({
|
|
134
|
+
preventScroll: true,
|
|
135
|
+
});
|
|
134
136
|
}, [readOnly]);
|
|
135
137
|
const handlePopperKeyDown = react_1.default.useCallback((event) => {
|
|
136
138
|
if (event.key === 'Escape') {
|
package/HintPopover/index.js
CHANGED
|
@@ -54,7 +54,7 @@ const HintPopover = props => {
|
|
|
54
54
|
const onKeyDown = (event) => {
|
|
55
55
|
if (event.key === 'Escape') {
|
|
56
56
|
setOpen(false);
|
|
57
|
-
button === null || button === void 0 ? void 0 : button.focus();
|
|
57
|
+
button === null || button === void 0 ? void 0 : button.focus({ preventScroll: true });
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
document.addEventListener('keydown', onKeyDown);
|
package/Menu/MenuContainer.js
CHANGED
|
@@ -285,10 +285,11 @@ const MenuContainer = react_1.default.forwardRef((props, ref) => {
|
|
|
285
285
|
if (!isOpen) {
|
|
286
286
|
// The menu is already closed by the parent, so onRequestClose must not be called again
|
|
287
287
|
dispatch((0, context_1.actionSetmenuState)({ markedIndex: -1, hoveredIndex: -1 }));
|
|
288
|
-
// Otherwise the focus is lost together with the unmounted list
|
|
288
|
+
// Otherwise the focus is lost together with the unmounted list.
|
|
289
|
+
// Without the scroll: an anchor in a sticky header is scrolled to its place in the document
|
|
289
290
|
if (hasFocusRef.current) {
|
|
290
291
|
hasFocusRef.current = false;
|
|
291
|
-
(_a = lastAnchorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
292
|
+
(_a = lastAnchorRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
292
293
|
}
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
@@ -303,7 +304,8 @@ const MenuContainer = react_1.default.forwardRef((props, ref) => {
|
|
|
303
304
|
var _a;
|
|
304
305
|
scrollToFirstSelected();
|
|
305
306
|
if (autofocus) {
|
|
306
|
-
|
|
307
|
+
// The list is already placed by the popper: focusing must not scroll the page
|
|
308
|
+
(_a = menuListRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
307
309
|
}
|
|
308
310
|
}, 15);
|
|
309
311
|
}, [isOpen, autofocus, dispatch, scrollToFirstSelected]);
|
|
@@ -59,7 +59,7 @@ const SelectboxMenu = React.forwardRef((props, ref) => {
|
|
|
59
59
|
if (onRequestClose) {
|
|
60
60
|
onRequestClose(evt);
|
|
61
61
|
}
|
|
62
|
-
anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.focus();
|
|
62
|
+
anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.focus({ preventScroll: true });
|
|
63
63
|
}
|
|
64
64
|
}, [onRequestClose, anchorElement]);
|
|
65
65
|
return (React.createElement(Menu_1.default, Object.assign({ ref: ref, offset: 0, anchorPos: anchorPos, multiple: multiple, items: items, value: value, isOpen: isOpen && items.length > 0, autofocus: true, anchorElement: anchorElement, closeOutsideClick: false, getOptionSelected: getOptionSelected, onSelectItem: handleSelectItem, closeOnSelect: !multiple, onRequestClose: handleRequestClose }, restMenuProps), ({ index, item }, itemProps) => children({ index, item: item }, itemProps)));
|
package/esm/DatePicker/index.js
CHANGED
|
@@ -111,7 +111,9 @@ const DatePicker = props => {
|
|
|
111
111
|
var _a, _b;
|
|
112
112
|
setOpenSate(false);
|
|
113
113
|
// Back to the field, so the keyboard user continues from the same place
|
|
114
|
-
(_b = (readOnly ? inputRef.current : ((_a = buttonRef.current) !== null && _a !== void 0 ? _a : inputRef.current))) === null || _b === void 0 ? void 0 : _b.focus(
|
|
114
|
+
(_b = (readOnly ? inputRef.current : ((_a = buttonRef.current) !== null && _a !== void 0 ? _a : inputRef.current))) === null || _b === void 0 ? void 0 : _b.focus({
|
|
115
|
+
preventScroll: true,
|
|
116
|
+
});
|
|
115
117
|
}, [readOnly]);
|
|
116
118
|
const handlePopperKeyDown = React.useCallback((event) => {
|
|
117
119
|
if (event.key === 'Escape') {
|
package/esm/HintPopover/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const HintPopover = props => {
|
|
|
35
35
|
const onKeyDown = (event) => {
|
|
36
36
|
if (event.key === 'Escape') {
|
|
37
37
|
setOpen(false);
|
|
38
|
-
button === null || button === void 0 ? void 0 : button.focus();
|
|
38
|
+
button === null || button === void 0 ? void 0 : button.focus({ preventScroll: true });
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
document.addEventListener('keydown', onKeyDown);
|
|
@@ -247,10 +247,11 @@ const MenuContainer = React.forwardRef((props, ref) => {
|
|
|
247
247
|
if (!isOpen) {
|
|
248
248
|
// The menu is already closed by the parent, so onRequestClose must not be called again
|
|
249
249
|
dispatch(actionSetmenuState({ markedIndex: -1, hoveredIndex: -1 }));
|
|
250
|
-
// Otherwise the focus is lost together with the unmounted list
|
|
250
|
+
// Otherwise the focus is lost together with the unmounted list.
|
|
251
|
+
// Without the scroll: an anchor in a sticky header is scrolled to its place in the document
|
|
251
252
|
if (hasFocusRef.current) {
|
|
252
253
|
hasFocusRef.current = false;
|
|
253
|
-
(_a = lastAnchorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
254
|
+
(_a = lastAnchorRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
254
255
|
}
|
|
255
256
|
return;
|
|
256
257
|
}
|
|
@@ -265,7 +266,8 @@ const MenuContainer = React.forwardRef((props, ref) => {
|
|
|
265
266
|
var _a;
|
|
266
267
|
scrollToFirstSelected();
|
|
267
268
|
if (autofocus) {
|
|
268
|
-
|
|
269
|
+
// The list is already placed by the popper: focusing must not scroll the page
|
|
270
|
+
(_a = menuListRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
269
271
|
}
|
|
270
272
|
}, 15);
|
|
271
273
|
}, [isOpen, autofocus, dispatch, scrollToFirstSelected]);
|
|
@@ -21,7 +21,7 @@ const SelectboxMenu = React.forwardRef((props, ref) => {
|
|
|
21
21
|
if (onRequestClose) {
|
|
22
22
|
onRequestClose(evt);
|
|
23
23
|
}
|
|
24
|
-
anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.focus();
|
|
24
|
+
anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.focus({ preventScroll: true });
|
|
25
25
|
}
|
|
26
26
|
}, [onRequestClose, anchorElement]);
|
|
27
27
|
return (React.createElement(Menu, Object.assign({ ref: ref, offset: 0, anchorPos: anchorPos, multiple: multiple, items: items, value: value, isOpen: isOpen && items.length > 0, autofocus: true, anchorElement: anchorElement, closeOutsideClick: false, getOptionSelected: getOptionSelected, onSelectItem: handleSelectItem, closeOnSelect: !multiple, onRequestClose: handleRequestClose }, restMenuProps), ({ index, item }, itemProps) => children({ index, item: item }, itemProps)));
|
package/esm/utils/TabManager.js
CHANGED
|
@@ -76,7 +76,7 @@ class TabManager {
|
|
|
76
76
|
__classPrivateFieldSet(this, _TabManager_stack, __classPrivateFieldGet(this, _TabManager_stack, "f").filter(stackElem => {
|
|
77
77
|
const founded = stackElem.container === container;
|
|
78
78
|
if (founded && revertBackFocus && stackElem.lastFocused instanceof HTMLElement) {
|
|
79
|
-
stackElem.lastFocused.focus();
|
|
79
|
+
stackElem.lastFocused.focus({ preventScroll: true });
|
|
80
80
|
}
|
|
81
81
|
return !founded;
|
|
82
82
|
}), "f");
|
package/package.json
CHANGED
package/utils/TabManager.js
CHANGED
|
@@ -78,7 +78,7 @@ class TabManager {
|
|
|
78
78
|
__classPrivateFieldSet(this, _TabManager_stack, __classPrivateFieldGet(this, _TabManager_stack, "f").filter(stackElem => {
|
|
79
79
|
const founded = stackElem.container === container;
|
|
80
80
|
if (founded && revertBackFocus && stackElem.lastFocused instanceof HTMLElement) {
|
|
81
|
-
stackElem.lastFocused.focus();
|
|
81
|
+
stackElem.lastFocused.focus({ preventScroll: true });
|
|
82
82
|
}
|
|
83
83
|
return !founded;
|
|
84
84
|
}), "f");
|