All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.util.InvisibleMessage.js.map Maven / Gradle / Ivy

{"version":3,"file":"InvisibleMessage.js","sourceRoot":"","sources":["../../src/util/InvisibleMessage.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,2BAA2B,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,IAAI,UAAuB,CAAC;AAC5B,IAAI,aAA0B,CAAC;AAE/B,MAAM,sBAAsB,GAAG,CAAC,EAAe,EAAE,EAAE;IAClD,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAC/B,EAAE,CAAC,KAAK,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,EAAE,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;IAC7B,EAAE,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;IAC1B,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC;IACzB,EAAE,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;AACjC,CAAC,CAAC;AAEF,UAAU,CAAC,GAAG,EAAE;IACf,IAAI,UAAU,IAAI,aAAa,EAAE;QAChC,OAAO;KACP;IAED,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAE/C,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IACxD,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAE9D,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC/C,aAAa,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAErD,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE5C,sBAAsB,CAAC,UAAU,CAAC,CAAC;IACnC,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAEtC,2BAA2B,CAAC,uBAAuB,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC7E,2BAA2B,CAAC,uBAAuB,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,IAA0B,EAAE,EAAE;IAChE,4DAA4D;IAC5D,MAAM,IAAI,GAAG,IAAI,KAAK,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC;IAElF,oFAAoF;IACpF,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACtB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAE3B,IAAI,IAAI,KAAK,oBAAoB,CAAC,SAAS,IAAI,IAAI,KAAK,oBAAoB,CAAC,MAAM,EAAE;QACpF,OAAO,CAAC,IAAI,CAAC,0IAA0I,CAAC,CAAC,CAAC,sBAAsB;KAChL;IAED,6EAA6E;IAC7E,UAAU,CAAC,GAAG,EAAE;QACf,iFAAiF;QACjF,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;YACjC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;SACtB;IACF,CAAC,EAAE,IAAI,CAAC,CAAC;AACV,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import InvisibleMessageMode from \"../types/InvisibleMessageMode.js\";\nimport getSingletonElementInstance from \"./getSingletonElementInstance.js\";\nimport { attachBoot } from \"../Boot.js\";\n\nlet politeSpan: HTMLElement;\nlet assertiveSpan: HTMLElement;\n\nconst setOutOfViewportStyles = (el: HTMLElement) => {\n\tel.style.position = \"absolute\";\n\tel.style.clip = \"rect(1px,1px,1px,1px)\";\n\tel.style.userSelect = \"none\";\n\tel.style.left = \"-1000px\";\n\tel.style.top = \"-1000px\";\n\tel.style.pointerEvents = \"none\";\n};\n\nattachBoot(() => {\n\tif (politeSpan && assertiveSpan) {\n\t\treturn;\n\t}\n\n\tpoliteSpan = document.createElement(\"span\");\n\tassertiveSpan = document.createElement(\"span\");\n\n\tpoliteSpan.classList.add(\"ui5-invisiblemessage-polite\");\n\tassertiveSpan.classList.add(\"ui5-invisiblemessage-assertive\");\n\n\tpoliteSpan.setAttribute(\"aria-live\", \"polite\");\n\tassertiveSpan.setAttribute(\"aria-live\", \"assertive\");\n\n\tpoliteSpan.setAttribute(\"role\", \"alert\");\n\tassertiveSpan.setAttribute(\"role\", \"alert\");\n\n\tsetOutOfViewportStyles(politeSpan);\n\tsetOutOfViewportStyles(assertiveSpan);\n\n\tgetSingletonElementInstance(\"ui5-announcement-area\").appendChild(politeSpan);\n\tgetSingletonElementInstance(\"ui5-announcement-area\").appendChild(assertiveSpan);\n});\n\n/**\n * Inserts the string into the respective span, depending on the mode provided.\n *\n * @param { string } message String to be announced by the screen reader.\n * @param { InvisibleMessageMode } mode The mode to be inserted in the aria-live attribute.\n * @public\n */\nconst announce = (message: string, mode: InvisibleMessageMode) => {\n\t// If no type is presented, fallback to polite announcement.\n\tconst span = mode === InvisibleMessageMode.Assertive ? assertiveSpan : politeSpan;\n\n\t// Set textContent to empty string in order to trigger screen reader's announcement.\n\tspan.textContent = \"\";\n\tspan.textContent = message;\n\n\tif (mode !== InvisibleMessageMode.Assertive && mode !== InvisibleMessageMode.Polite) {\n\t\tconsole.warn(`You have entered an invalid mode. Valid values are: \"Polite\" and \"Assertive\". The framework will automatically set the mode to \"Polite\".`); // eslint-disable-line\n\t}\n\n\t// clear the span in order to avoid reading it out while in JAWS reading node\n\tsetTimeout(() => {\n\t\t// ensure that we clear the text node only if no announce is made in the meantime\n\t\tif (span.textContent === message) {\n\t\t\tspan.textContent = \"\";\n\t\t}\n\t}, 3000);\n};\n\nexport default announce;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy