accessible-description.mjs.map 2.08 KB
{"version":3,"sources":["../sources/accessible-description.ts"],"names":["computeTextAlternative","queryIdRefs","computeAccessibleDescription","root","options","description","map","element","compute","join","title","getAttribute"],"mappings":";;;;;;AAAA,SACCA,sBADD,QAGO,uCAHP;AAIA,SAASC,WAAT,QAA4B,YAA5B;AAEA;;;;;;;AAMA,OAAO,SAASC,4BAAT,CACNC,IADM,EAGG;AAAA,MADTC,OACS,uEADgC,EAChC;AACT,MAAIC,WAAW,GAAGJ,WAAW,CAACE,IAAD,EAAO,kBAAP,CAAX,CAChBG,GADgB,CACZ,UAACC,OAAD,EAAa;AACjB,WAAOP,sBAAsB,CAACO,OAAD,kCACzBH,OADyB;AAE5BI,MAAAA,OAAO,EAAE;AAFmB,OAA7B;AAIA,GANgB,EAOhBC,IAPgB,CAOX,GAPW,CAAlB,CADS,CAUT;AACA;AACA;AACA;AACA;;AACA,MAAIJ,WAAW,KAAK,EAApB,EAAwB;AACvB,QAAMK,KAAK,GAAGP,IAAI,CAACQ,YAAL,CAAkB,OAAlB,CAAd;AACAN,IAAAA,WAAW,GAAGK,KAAK,KAAK,IAAV,GAAiB,EAAjB,GAAsBA,KAApC;AACA;;AAED,SAAOL,WAAP;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"],"file":"accessible-description.mjs"}