mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
16 lines
802 B
JavaScript
16 lines
802 B
JavaScript
import { containsComposed, getDeepActiveElement } from "@videojs/utils/dom";
|
|
//#region src/dom/ui/container-attrs.ts
|
|
const DEFAULT_CONTAINER_ROLE = "group";
|
|
const DEFAULT_CONTAINER_TAB_INDEX = 0;
|
|
function applyContainerAttrs(element) {
|
|
if (!element.hasAttribute("role")) element.setAttribute("role", DEFAULT_CONTAINER_ROLE);
|
|
if (!element.hasAttribute("tabindex")) element.setAttribute("tabindex", String(0));
|
|
}
|
|
function focusContainer(element) {
|
|
const active = getDeepActiveElement(element.ownerDocument);
|
|
if (!active || active === element.ownerDocument.body || !containsComposed(element, active)) element.focus({ preventScroll: true });
|
|
}
|
|
//#endregion
|
|
export { DEFAULT_CONTAINER_ROLE, DEFAULT_CONTAINER_TAB_INDEX, applyContainerAttrs, focusContainer };
|
|
|
|
//# sourceMappingURL=container-attrs.js.map
|