@limetech/lime-elements 37.1.0-next.89 → 37.1.0-next.90

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 CHANGED
@@ -1,3 +1,12 @@
1
+ ## [37.1.0-next.90](https://github.com/Lundalogik/lime-elements/compare/v37.1.0-next.89...v37.1.0-next.90) (2024-01-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+
7
+ * **menu:** keyboard navigation in search results ([e202ea5](https://github.com/Lundalogik/lime-elements/commit/e202ea5b937caf2d0ea810fdb05bcc2964cb7343))
8
+ * **menu:** keyboard navigation when last/first list item is a separator ([4c6d5f8](https://github.com/Lundalogik/lime-elements/commit/4c6d5f8e01293587ffe53620baa416ce547ba3f6))
9
+
1
10
  ## [37.1.0-next.89](https://github.com/Lundalogik/lime-elements/compare/v37.1.0-next.88...v37.1.0-next.89) (2024-01-16)
2
11
 
3
12
 
@@ -168,9 +168,6 @@ const Menu = class {
168
168
  };
169
169
  this.renderMenuList = () => {
170
170
  let items = this.visibleItems;
171
- if (Array.isArray(this.searchResults) && this.searchValue) {
172
- items = this.searchResults;
173
- }
174
171
  if (this.loadingSubItems || this.loading) {
175
172
  items = [];
176
173
  }
@@ -213,13 +210,15 @@ const Menu = class {
213
210
  event.stopPropagation();
214
211
  event.preventDefault();
215
212
  if (isForwardTab || isDown) {
216
- const listElement = this.list.shadowRoot.querySelector('.mdc-deprecated-list-item:first-child');
217
- listElement.focus();
213
+ const listItems = this.list.shadowRoot.querySelectorAll('.mdc-deprecated-list-item');
214
+ const listElement = listItems[0];
215
+ listElement === null || listElement === void 0 ? void 0 : listElement.focus();
218
216
  return;
219
217
  }
220
218
  if (isUp) {
221
- const listElement = this.list.shadowRoot.querySelector('.mdc-deprecated-list-item:last-child');
222
- listElement.focus();
219
+ const listItems = this.list.shadowRoot.querySelectorAll('.mdc-deprecated-list-item');
220
+ const listElement = listItems[listItems.length - 1];
221
+ listElement === null || listElement === void 0 ? void 0 : listElement.focus();
223
222
  }
224
223
  };
225
224
  // Key handler for the menu list
@@ -508,7 +507,10 @@ const Menu = class {
508
507
  }
509
508
  get visibleItems() {
510
509
  var _a;
511
- if (Array.isArray((_a = this.currentSubMenu) === null || _a === void 0 ? void 0 : _a.items)) {
510
+ if (Array.isArray(this.searchResults) && this.searchValue) {
511
+ return this.searchResults;
512
+ }
513
+ else if (Array.isArray((_a = this.currentSubMenu) === null || _a === void 0 ? void 0 : _a.items)) {
512
514
  return this.currentSubMenu.items.map((item) => (Object.assign(Object.assign({}, item), { parentItem: this.currentSubMenu })));
513
515
  }
514
516
  return this.items;