This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1 @@
export declare function getActiveElement(document: Document | ShadowRoot): Element | null;

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getActiveElement = getActiveElement;
var _isDisabled = require("../misc/isDisabled");
function getActiveElement(document) {
const activeElement = document.activeElement;
if (activeElement != null && activeElement.shadowRoot) {
return getActiveElement(activeElement.shadowRoot);
} else {
// Browser does not yield disabled elements as document.activeElement - jsdom does
if ((0, _isDisabled.isDisabled)(activeElement)) {
return document.ownerDocument ? // TODO: verify behavior in ShadowRoot
/* istanbul ignore next */
document.ownerDocument.body : document.body;
}
return activeElement;
}
}

View File

@@ -0,0 +1 @@
export declare function isFocusable(element: Element): element is HTMLElement;

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isFocusable = isFocusable;
var _isLabelWithInternallyDisabledControl = require("../misc/isLabelWithInternallyDisabledControl");
var _selector = require("./selector");
function isFocusable(element) {
return !(0, _isLabelWithInternallyDisabledControl.isLabelWithInternallyDisabledControl)(element) && element.matches(_selector.FOCUSABLE_SELECTOR);
}

View File

@@ -0,0 +1 @@
export declare const FOCUSABLE_SELECTOR: string;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FOCUSABLE_SELECTOR = void 0;
const FOCUSABLE_SELECTOR = ['input:not([type=hidden]):not([disabled])', 'button:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', '[contenteditable=""]', '[contenteditable="true"]', 'a[href]', '[tabindex]:not([disabled])'].join(', ');
exports.FOCUSABLE_SELECTOR = FOCUSABLE_SELECTOR;