@vaadin/component-base 24.9.14 → 24.9.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "24.9.14",
3
+ "version": "24.9.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,10 +38,10 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "~24.9.14",
42
- "@vaadin/test-runner-commands": "~24.9.14",
41
+ "@vaadin/chai-plugins": "~24.9.16",
42
+ "@vaadin/test-runner-commands": "~24.9.16",
43
43
  "@vaadin/testing-helpers": "^1.1.0",
44
44
  "sinon": "^18.0.0"
45
45
  },
46
- "gitHead": "50398d652287304f9092a52aeb066bd12d2f86ca"
46
+ "gitHead": "518ee03db7a60c23ce70008af8793f19e9c0fcd2"
47
47
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '24.9.14') {
16
+ export function defineCustomElement(CustomElement, version = '24.9.16') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -484,11 +484,19 @@ export class IronListAdapter {
484
484
 
485
485
  /** @private */
486
486
  __getFocusedElement(visibleElements = this.__getVisibleElements()) {
487
- return visibleElements.find(
488
- (element) =>
489
- element.contains(this.elementsContainer.getRootNode().activeElement) ||
490
- element.contains(this.scrollTarget.getRootNode().activeElement),
491
- );
487
+ // `document.activeElement` retargets to the outermost shadow host when
488
+ // focus lives in a nested shadow tree. Descend through nested shadow
489
+ // roots' `activeElement`s to reach the real focused node, then walk up
490
+ // the flattened tree (via `assignedSlot`/`parentNode`/`host`) until a
491
+ // visible row is reached.
492
+ let node = document.activeElement;
493
+ while (node?.shadowRoot?.activeElement) {
494
+ node = node.shadowRoot.activeElement;
495
+ }
496
+ while (node && !visibleElements.includes(node)) {
497
+ node = node.assignedSlot || node.parentNode || node.host;
498
+ }
499
+ return node;
492
500
  }
493
501
 
494
502
  /** @private */