@jetbrains/ring-ui 5.0.168 → 5.0.169

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.
@@ -338,7 +338,9 @@ export default class Select extends Component {
338
338
  }
339
339
  };
340
340
  focus = () => {
341
- this.node?.focus();
341
+ const focusableSelectExists = this.node?.querySelector('[data-test~=ring-select__focus]');
342
+ const restoreFocusNode = this.props.targetElement || focusableSelectExists;
343
+ restoreFocusNode?.focus();
342
344
  };
343
345
  _onEnter = () => {
344
346
  if (this.state.addButton && this.state.shownData.length === 0) {
@@ -462,12 +464,7 @@ export default class Select extends Component {
462
464
  filterValue: this.props.allowAny ? prevState.filterValue : ''
463
465
  }));
464
466
  if (tryFocusAnchor) {
465
- const focusableSelectExists = this.node &&
466
- this.node.querySelector('[data-test~=ring-select__focus]');
467
- const restoreFocusNode = this.props.targetElement || focusableSelectExists;
468
- if (restoreFocusNode) {
469
- restoreFocusNode.focus();
470
- }
467
+ this.focus();
471
468
  }
472
469
  }
473
470
  }
@@ -349,7 +349,9 @@ var Select = /*#__PURE__*/function (_Component) {
349
349
  });
350
350
  _defineProperty(_assertThisInitialized(_this), "focus", function () {
351
351
  var _this$node;
352
- (_this$node = _this.node) === null || _this$node === void 0 ? void 0 : _this$node.focus();
352
+ var focusableSelectExists = (_this$node = _this.node) === null || _this$node === void 0 ? void 0 : _this$node.querySelector('[data-test~=ring-select__focus]');
353
+ var restoreFocusNode = _this.props.targetElement || focusableSelectExists;
354
+ restoreFocusNode === null || restoreFocusNode === void 0 ? void 0 : restoreFocusNode.focus();
353
355
  });
354
356
  _defineProperty(_assertThisInitialized(_this), "_onEnter", function () {
355
357
  var _this$_popup2;
@@ -789,11 +791,7 @@ var Select = /*#__PURE__*/function (_Component) {
789
791
  };
790
792
  });
791
793
  if (tryFocusAnchor) {
792
- var focusableSelectExists = this.node && this.node.querySelector('[data-test~=ring-select__focus]');
793
- var restoreFocusNode = this.props.targetElement || focusableSelectExists;
794
- if (restoreFocusNode) {
795
- restoreFocusNode.focus();
796
- }
794
+ this.focus();
797
795
  }
798
796
  }
799
797
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.168",
3
+ "version": "5.0.169",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",