@fundamental-ngx/cdk 0.64.0 → 0.64.1-rc.1
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.
|
@@ -1561,15 +1561,16 @@ class TabbableElementService {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
/** Get the first tabbable element from a DOM subtree (inclusive). */
|
|
1563
1563
|
getTabbableElement(root, focusLastElement = false, skipSelf = false) {
|
|
1564
|
-
if (!skipSelf && this.
|
|
1564
|
+
if (!skipSelf && this._isTabbableElement(root)) {
|
|
1565
1565
|
return root;
|
|
1566
1566
|
}
|
|
1567
|
+
const elementNodeType = this._document?.ELEMENT_NODE ?? 1;
|
|
1567
1568
|
// Iterate in DOM order. Note that IE doesn't have `children` for SVG, so we fall
|
|
1568
1569
|
// back to `childNodes` which includes text nodes, comments etc.
|
|
1569
1570
|
const rootChildren = root.children || root.childNodes;
|
|
1570
1571
|
const children = focusLastElement ? Array.from(rootChildren).reverse() : rootChildren;
|
|
1571
1572
|
for (let i = 0; i < children.length; i++) {
|
|
1572
|
-
const tabbableChild = children[i].nodeType ===
|
|
1573
|
+
const tabbableChild = children[i].nodeType === elementNodeType
|
|
1573
1574
|
? this.getTabbableElement(children[i], focusLastElement)
|
|
1574
1575
|
: null;
|
|
1575
1576
|
if (tabbableChild) {
|
|
@@ -1578,6 +1579,14 @@ class TabbableElementService {
|
|
|
1578
1579
|
}
|
|
1579
1580
|
return null;
|
|
1580
1581
|
}
|
|
1582
|
+
_isTabbableElement(element) {
|
|
1583
|
+
return this._checker.isTabbable(element) && !this._isElementDisabled(element);
|
|
1584
|
+
}
|
|
1585
|
+
_isElementDisabled(element) {
|
|
1586
|
+
return (element.hasAttribute('disabled') ||
|
|
1587
|
+
element.getAttribute('aria-disabled') === 'true' ||
|
|
1588
|
+
element.classList.contains('is-disabled'));
|
|
1589
|
+
}
|
|
1581
1590
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TabbableElementService, deps: [{ token: i1$1.InteractivityChecker }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1582
1591
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TabbableElementService, providedIn: 'root' }); }
|
|
1583
1592
|
}
|