1 |
- {"ast":null,"code":"function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport { computeTextAlternative } from \"./accessible-name-and-description.mjs\";\nimport { queryIdRefs } from \"./util.mjs\";\n/**\n * implements https://w3c.github.io/accname/#mapping_additional_nd_description\n * @param root\n * @param [options]\n * @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility`\n */\n\nexport function computeAccessibleDescription(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var description = queryIdRefs(root, \"aria-describedby\").map(function (element) {\n return computeTextAlternative(element, _objectSpread(_objectSpread({}, options), {}, {\n compute: \"description\"\n }));\n }).join(\" \"); // TODO: Technically we need to make sure that node wasn't used for the accessible name\n // This causes `description_1.0_combobox-focusable-manual` to fail\n //\n // https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation\n // says for so many elements to use the `title` that we assume all elements are considered\n\n if (description === \"\") {\n var title = root.getAttribute(\"title\");\n description = title === null ? \"\" : title;\n }\n\n return description;\n}","map":{"version":3,"sources":["../sources/accessible-description.ts"],"names":["options","description","computeTextAlternative","compute","title","root"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAA,sBAAA,QAAA,uCAAA;AAIA,SAAA,WAAA,QAAA,YAAA;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAA,4BAAA,CAAA,IAAA,EAGG;AAAA,MADTA,OACS,GAAA,SAAA,CAAA,MAAA,GAAA,CAAA,IAAA,SAAA,CAAA,CAAA,CAAA,KAAA,SAAA,GAAA,SAAA,CAAA,CAAA,CAAA,GADgC,EAChC;AACT,MAAIC,WAAW,GAAG,WAAW,CAAA,IAAA,EAAX,kBAAW,CAAX,CAAA,GAAA,CACZ,UAAA,OAAA,EAAa;AACjB,WAAOC,sBAAsB,CAAA,OAAA,EAAA,aAAA,CAAA,aAAA,CAAA,EAAA,EAAA,OAAA,CAAA,EAAA,EAAA,EAAA;AAE5BC,MAAAA,OAAO,EAAE;AAFmB,KAAA,CAAA,CAA7B;AAFgB,GAAA,EAAA,IAAA,CADT,GACS,CAAlB,CADS,CAUT;AACA;AACA;AACA;AACA;;AACA,MAAIF,WAAW,KAAf,EAAA,EAAwB;AACvB,QAAMG,KAAK,GAAGC,IAAI,CAAJA,YAAAA,CAAd,OAAcA,CAAd;AACAJ,IAAAA,WAAW,GAAGG,KAAK,KAALA,IAAAA,GAAAA,EAAAA,GAAdH,KAAAA;AACA;;AAED,SAAA,WAAA;AACA","sourcesContent":["import {\n\tcomputeTextAlternative,\n\tComputeTextAlternativeOptions,\n} from \"./accessible-name-and-description\";\nimport { queryIdRefs } from \"./util\";\n\n/**\n * implements https://w3c.github.io/accname/#mapping_additional_nd_description\n * @param root\n * @param [options]\n * @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility`\n */\nexport function computeAccessibleDescription(\n\troot: Element,\n\toptions: ComputeTextAlternativeOptions = {}\n): string {\n\tlet description = queryIdRefs(root, \"aria-describedby\")\n\t\t.map((element) => {\n\t\t\treturn computeTextAlternative(element, {\n\t\t\t\t...options,\n\t\t\t\tcompute: \"description\",\n\t\t\t});\n\t\t})\n\t\t.join(\" \");\n\n\t// TODO: Technically we need to make sure that node wasn't used for the accessible name\n\t// This causes `description_1.0_combobox-focusable-manual` to fail\n\t//\n\t// https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation\n\t// says for so many elements to use the `title` that we assume all elements are considered\n\tif (description === \"\") {\n\t\tconst title = root.getAttribute(\"title\");\n\t\tdescription = title === null ? \"\" : title;\n\t}\n\n\treturn description;\n}\n"]},"metadata":{},"sourceType":"module"}
|