@jetbrains/ring-ui-built 6.0.41 → 6.0.42
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.
@@ -43,6 +43,6 @@ export default class DateInput extends React.PureComponent<DateInputProps> {
|
|
43
43
|
inputRef: (el: HTMLInputElement | null) => void;
|
44
44
|
updateInput({ text, active }: UpdateInputConfig): void;
|
45
45
|
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
46
|
-
handleKeyDown: (e: React.KeyboardEvent) =>
|
46
|
+
handleKeyDown: (e: React.KeyboardEvent) => void;
|
47
47
|
render(): React.JSX.Element;
|
48
48
|
}
|
@@ -59,7 +59,14 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
|
|
59
59
|
return _this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
|
60
60
|
});
|
61
61
|
_defineProperty(_this, "handleKeyDown", function (e) {
|
62
|
-
|
62
|
+
if (e.key === 'Enter') {
|
63
|
+
// We have to prevent the default behavior, because restoring focus by TabTrap caused by
|
64
|
+
// pressing Enter will trigger the onClick event on the DatePicker Dropdown anchor,
|
65
|
+
// so DatePicker will be open again.
|
66
|
+
// https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
|
67
|
+
e.preventDefault();
|
68
|
+
_this.props.onConfirm();
|
69
|
+
}
|
63
70
|
});
|
64
71
|
return _this;
|
65
72
|
}
|
@@ -83,18 +83,13 @@ var TabTrap = /*#__PURE__*/forwardRef(function TabTrap(_ref, ref) {
|
|
83
83
|
function restoreFocus() {
|
84
84
|
var previousFocusedNode = previousFocusedNodeRef.current;
|
85
85
|
if (previousFocusedNode instanceof HTMLElement && previousFocusedNode.focus && isNodeInVisiblePartOfPage(previousFocusedNode)) {
|
86
|
-
//
|
87
|
-
//
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
previousFocusedNode.focus({
|
94
|
-
preventScroll: true
|
95
|
-
});
|
96
|
-
}
|
97
|
-
});
|
86
|
+
// This is to prevent the focus from being restored the first time
|
87
|
+
// componentWillUnmount is called in StrictMode.
|
88
|
+
if (!mountedRef.current) {
|
89
|
+
previousFocusedNode.focus({
|
90
|
+
preventScroll: true
|
91
|
+
});
|
92
|
+
}
|
98
93
|
}
|
99
94
|
}
|
100
95
|
function focusElement() {
|