@nectary/components 5.53.0 → 5.53.2

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.
@@ -80,7 +80,9 @@ class ActionMenu extends NectaryElement {
80
80
  const isTextInput = activeElement !== null && activeElement.tagName === "INPUT";
81
81
  if (!isTextInput) {
82
82
  this.focus();
83
- this.#selectOption(this.#getFirstOption());
83
+ if (this.matches(":focus-visible")) {
84
+ this.#selectOption(this.#getFirstOption());
85
+ }
84
86
  }
85
87
  }
86
88
  };
package/bundle.js CHANGED
@@ -987,7 +987,9 @@ class ActionMenu extends NectaryElement {
987
987
  const isTextInput = activeElement !== null && activeElement.tagName === "INPUT";
988
988
  if (!isTextInput) {
989
989
  this.focus();
990
- this.#selectOption(this.#getFirstOption());
990
+ if (this.matches(":focus-visible")) {
991
+ this.#selectOption(this.#getFirstOption());
992
+ }
991
993
  }
992
994
  }
993
995
  };
@@ -3805,6 +3807,7 @@ class Tooltip extends NectaryElement {
3805
3807
  updateBooleanAttribute(this.#$pop, "disable-focus-restore", true);
3806
3808
  this.#updatePopA11yAttrs();
3807
3809
  this.#updateText();
3810
+ this.#restoreControlledOpen();
3808
3811
  }
3809
3812
  disconnectedCallback() {
3810
3813
  super.disconnectedCallback();
@@ -4586,6 +4589,20 @@ class Tooltip extends NectaryElement {
4586
4589
  #isOpen() {
4587
4590
  return this.#$pop.hasAttribute("open");
4588
4591
  }
4592
+ // `is-opened` can be set before the element is connected (e.g. React 19 reveals a
4593
+ // Suspense boundary later): the pop opened, but the reveal was dropped while
4594
+ // disconnected. Disconnecting also hides the tooltip, so reapply `is-opened` on reconnect.
4595
+ #restoreControlledOpen() {
4596
+ if (this.isOpenedControlled !== true) {
4597
+ return;
4598
+ }
4599
+ if (this.#isOpen()) {
4600
+ this.#schedulePlacement();
4601
+ this.#scheduleReveal(++this.#revealRequestId);
4602
+ } else {
4603
+ this.#tooltipState.show();
4604
+ }
4605
+ }
4589
4606
  #dispatchShowEvent() {
4590
4607
  this.dispatchEvent(new CustomEvent("-show"));
4591
4608
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.53.0",
3
+ "version": "5.53.2",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -36,6 +36,7 @@
36
36
  "@types/react": "^18.2.21",
37
37
  "babel-plugin-html-inline-minifier": "workspace:*",
38
38
  "dts-bundle-generator": "^9.5.1",
39
+ "tsx": "^4.19.0",
39
40
  "typescript": "^5.2.2",
40
41
  "vite": "^7.0.6"
41
42
  },
package/tooltip/index.js CHANGED
@@ -124,6 +124,7 @@ class Tooltip extends NectaryElement {
124
124
  updateBooleanAttribute(this.#$pop, "disable-focus-restore", true);
125
125
  this.#updatePopA11yAttrs();
126
126
  this.#updateText();
127
+ this.#restoreControlledOpen();
127
128
  }
128
129
  disconnectedCallback() {
129
130
  super.disconnectedCallback();
@@ -905,6 +906,20 @@ class Tooltip extends NectaryElement {
905
906
  #isOpen() {
906
907
  return this.#$pop.hasAttribute("open");
907
908
  }
909
+ // `is-opened` can be set before the element is connected (e.g. React 19 reveals a
910
+ // Suspense boundary later): the pop opened, but the reveal was dropped while
911
+ // disconnected. Disconnecting also hides the tooltip, so reapply `is-opened` on reconnect.
912
+ #restoreControlledOpen() {
913
+ if (this.isOpenedControlled !== true) {
914
+ return;
915
+ }
916
+ if (this.#isOpen()) {
917
+ this.#schedulePlacement();
918
+ this.#scheduleReveal(++this.#revealRequestId);
919
+ } else {
920
+ this.#tooltipState.show();
921
+ }
922
+ }
908
923
  #dispatchShowEvent() {
909
924
  this.dispatchEvent(new CustomEvent("-show"));
910
925
  }