accessible-description.js.map
1.82 KB
{"version":3,"sources":["../sources/accessible-description.ts"],"names":["computeAccessibleDescription","root","options","description","map","element","compute","join","title","getAttribute"],"mappings":";;;;;AAAA;;AAIA;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,4BAAT,CACNC,IADM,EAGG;AAAA,MADTC,OACS,uEADgC,EAChC;AACT,MAAIC,WAAW,GAAG,uBAAYF,IAAZ,EAAkB,kBAAlB,EAChBG,GADgB,CACZ,UAACC,OAAD,EAAa;AACjB,WAAO,0DAAuBA,OAAvB,kCACHH,OADG;AAENI,MAAAA,OAAO,EAAE;AAFH,OAAP;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 * @param root\n * @param options\n * @returns\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.js"}