pour-engine 1.22.0 → 1.23.0

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.
@@ -6,6 +6,6 @@
6
6
  export default {
7
7
  engine: {
8
8
  name: 'pour engine',
9
- version: '1.22.0',
9
+ version: '1.23.0',
10
10
  },
11
11
  };
@@ -38,7 +38,19 @@ export default {
38
38
  ?? IMPLICIT_CONTAINER[owner.tagName.toLowerCase()]);
39
39
  if (ownerRole && containers.includes(ownerRole)) return { status: 'pass' };
40
40
  }
41
- for (let parent = element.parentElement; parent; parent = parent.parentElement) {
41
+ // FLAT-TREE ancestry, not light-DOM ancestry: assistive technology sees
42
+ // the composed tree, so a slotted role="listitem" whose role="list"
43
+ // container lives inside the host component's shadow root IS inside a
44
+ // list (Adobe Spectrum's sidenav is exactly this — a light-DOM walk was
45
+ // 11 false asserts on one page). An element assigned to a slot continues
46
+ // through the slot's shadow-side ancestors; an element at a shadow root's
47
+ // top continues through the host.
48
+ const flatParent = (node) => node.assignedSlot
49
+ ?? node.parentElement
50
+ ?? (node.getRootNode() instanceof ShadowRoot ? node.getRootNode().host : null);
51
+ for (let parent = flatParent(element); parent; parent = flatParent(parent)) {
52
+ // A <slot> is rendering plumbing with no tree presence of its own.
53
+ if (parent.tagName === 'SLOT' && !parent.hasAttribute('role')) continue;
42
54
  const parentRole =
43
55
  parent.getAttribute('role')?.trim().split(/\s+/)[0]?.toLowerCase() ??
44
56
  IMPLICIT_CONTAINER[parent.tagName.toLowerCase()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pour-engine",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "Accessibility (WCAG 2.2) audit engine written from the W3C specifications — runs entirely in the browser, no dependencies.",
5
5
  "type": "module",
6
6
  "main": "engine/index.js",