MCPcopy Create free account
hub / github.com/UI5/webcomponents / isElementTabbable

Function isElementTabbable

packages/base/src/util/isElementTabbable.ts:10–34  ·  view source on GitHub ↗
(el: HTMLElement)

Source from the content-addressed store, hash-verified

8 * @returns { boolean } true if the element is tabbable or false - if not
9 */
10const isElementTabbable = (el: HTMLElement): boolean => {
11 if (!el) {
12 return false;
13 }
14
15 if (el.hasAttribute("data-sap-no-tab-ref")) {
16 return false;
17 }
18
19 if (isElementHidden(el)) {
20 return false;
21 }
22
23 const tabIndex = el.getAttribute("tabindex");
24 if (tabIndex !== null && tabIndex !== undefined) {
25 return parseInt(tabIndex) >= 0;
26 }
27
28 const nodeName = el.nodeName.toLowerCase();
29 if (nodeName === "a" || /^(input|select|textarea|button|object)$/.test(nodeName)) {
30 return !(el as HTMLLinkElement).disabled;
31 }
32
33 return false;
34};
35
36export default isElementTabbable;

Callers 1

getTabbablesFunction · 0.85

Calls 2

isElementHiddenFunction · 0.85
hasAttributeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…