@nectary/components 4.11.1 → 4.11.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.
@@ -81,6 +81,13 @@ export class ActionMenu extends NectaryElement {
81
81
  top: 0,
82
82
  behavior: 'auto'
83
83
  });
84
+ } else {
85
+ const activeElement = this.#getDeepActiveElement();
86
+ const isTextInput = activeElement !== null && activeElement.tagName === 'INPUT';
87
+ if (!isTextInput) {
88
+ this.focus();
89
+ this.#selectOption(this.#getFirstOption());
90
+ }
84
91
  }
85
92
  };
86
93
  #handleKeydown(e) {
@@ -155,6 +162,13 @@ export class ActionMenu extends NectaryElement {
155
162
  }
156
163
  return this.#getLastOption();
157
164
  }
165
+ #getDeepActiveElement() {
166
+ let activeElement = this.ownerDocument.activeElement;
167
+ while (activeElement !== null && activeElement.shadowRoot !== null && activeElement.shadowRoot.activeElement !== null) {
168
+ activeElement = activeElement.shadowRoot.activeElement;
169
+ }
170
+ return activeElement;
171
+ }
158
172
  #selectOption($option) {
159
173
  const hasRows = this.hasAttribute('rows');
160
174
  for (const $op of this.#getOptionElements()) {
@@ -166,6 +180,15 @@ export class ActionMenu extends NectaryElement {
166
180
  });
167
181
  }
168
182
  }
183
+ if ($option !== null) {
184
+ $option.focus();
185
+ $option.onmouseover = e => {
186
+ if (e.defaultPrevented) {
187
+ return;
188
+ }
189
+ this.#selectOption(null);
190
+ };
191
+ }
169
192
  }
170
193
  #getOptionElements() {
171
194
  return this.#$optionSlot.assignedElements();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "4.11.1",
3
+ "version": "4.11.2",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",