@ui5/webcomponents-base 2.26.0-rc.0 → 2.26.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/animations/animate.d.ts +1 -1
- package/dist/animations/animate.js +4 -1
- package/dist/animations/animate.js.map +1 -1
- package/dist/animations/scroll.js +1 -1
- package/dist/animations/scroll.js.map +1 -1
- package/dist/animations/slideDown.js +1 -1
- package/dist/animations/slideDown.js.map +1 -1
- package/dist/animations/slideUp.js +1 -1
- package/dist/animations/slideUp.js.map +1 -1
- package/dist/config/AnimationMode.js +6 -0
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/css/CommonStyles.css +6 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/generated/css/CommonStyles.css.d.ts +2 -0
- package/dist/generated/css/CommonStyles.css.js +2 -0
- package/dist/generated/css/CommonStyles.css.js.map +1 -0
- package/dist/prod/animations/animate.js +1 -1
- package/dist/prod/animations/animate.js.map +3 -3
- package/dist/prod/animations/scroll.js +1 -1
- package/dist/prod/animations/scroll.js.map +2 -2
- package/dist/prod/animations/slideDown.js +1 -1
- package/dist/prod/animations/slideDown.js.map +2 -2
- package/dist/prod/animations/slideUp.js +1 -1
- package/dist/prod/animations/slideUp.js.map +2 -2
- package/dist/prod/config/AnimationMode.js +1 -1
- package/dist/prod/config/AnimationMode.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/dist/prod/generated/css/CommonStyles.css.js +2 -0
- package/dist/prod/generated/css/CommonStyles.css.js.map +7 -0
- package/dist/prod/sap/base/security/sanitizeHTML.js +3 -3
- package/dist/prod/theming/componentStyles.js +3 -2
- package/dist/prod/theming/componentStyles.js.map +3 -3
- package/dist/prod/util/InvisibleMessage.js +1 -1
- package/dist/prod/util/InvisibleMessage.js.map +3 -3
- package/dist/sap/base/security/sanitizeHTML.js +3 -3
- package/dist/theming/componentStyles.js +3 -0
- package/dist/theming/componentStyles.js.map +1 -1
- package/dist/util/InvisibleMessage.d.ts +21 -0
- package/dist/util/InvisibleMessage.js +63 -11
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/package.json +4 -4
- package/src/css/CommonStyles.css +6 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import InvisibleMessageMode from "../types/InvisibleMessageMode.js";
|
|
2
2
|
import getSingletonElementInstance from "./getSingletonElementInstance.js";
|
|
3
3
|
import { attachBoot } from "../Boot.js";
|
|
4
|
-
let
|
|
5
|
-
|
|
4
|
+
let defaultSpans;
|
|
5
|
+
const regions = [];
|
|
6
6
|
const setOutOfViewportStyles = (el) => {
|
|
7
7
|
el.style.position = "absolute";
|
|
8
8
|
el.style.clip = "rect(1px,1px,1px,1px)";
|
|
@@ -11,12 +11,12 @@ const setOutOfViewportStyles = (el) => {
|
|
|
11
11
|
el.style.top = "-1000px";
|
|
12
12
|
el.style.pointerEvents = "none";
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
politeSpan = document.createElement("span");
|
|
19
|
-
assertiveSpan = document.createElement("span");
|
|
14
|
+
/**
|
|
15
|
+
* Creates a pair of off-viewport aria-live spans (polite and assertive) to be used for screen reader announcements.
|
|
16
|
+
*/
|
|
17
|
+
const createAnnouncementSpans = () => {
|
|
18
|
+
const politeSpan = document.createElement("span");
|
|
19
|
+
const assertiveSpan = document.createElement("span");
|
|
20
20
|
politeSpan.classList.add("ui5-invisiblemessage-polite");
|
|
21
21
|
assertiveSpan.classList.add("ui5-invisiblemessage-assertive");
|
|
22
22
|
politeSpan.setAttribute("aria-live", "polite");
|
|
@@ -25,9 +25,53 @@ attachBoot(() => {
|
|
|
25
25
|
assertiveSpan.setAttribute("role", "alert");
|
|
26
26
|
setOutOfViewportStyles(politeSpan);
|
|
27
27
|
setOutOfViewportStyles(assertiveSpan);
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
return { polite: politeSpan, assertive: assertiveSpan };
|
|
29
|
+
};
|
|
30
|
+
attachBoot(() => {
|
|
31
|
+
if (defaultSpans) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
defaultSpans = createAnnouncementSpans();
|
|
35
|
+
const announcementArea = getSingletonElementInstance("ui5-announcement-area");
|
|
36
|
+
announcementArea.appendChild(defaultSpans.polite);
|
|
37
|
+
announcementArea.appendChild(defaultSpans.assertive);
|
|
30
38
|
});
|
|
39
|
+
/**
|
|
40
|
+
* Registers an element as an aria-live region container. A pair of hidden aria-live spans (polite and assertive)
|
|
41
|
+
* is created inside the provided container, and subsequent announcements are routed there while it stays registered.
|
|
42
|
+
*
|
|
43
|
+
* This is used to render the aria-live region inside a dialog/popover, so that announcements made while a modal
|
|
44
|
+
* popup is open (and the screen reader's accessibility tree is scoped to the popup's subtree) are still read out.
|
|
45
|
+
*
|
|
46
|
+
* @param { HTMLElement } container The element that will host the aria-live spans.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
const registerInvisibleMessageRegion = (container) => {
|
|
50
|
+
if (regions.some(region => region.container === container)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const spans = createAnnouncementSpans();
|
|
54
|
+
container.appendChild(spans.polite);
|
|
55
|
+
container.appendChild(spans.assertive);
|
|
56
|
+
regions.push({ container, spans });
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Deregisters a previously registered aria-live region container, removing its aria-live spans.
|
|
60
|
+
* After deregistration, announcements are routed to the next registered region, or to the default
|
|
61
|
+
* body-level region if none remain.
|
|
62
|
+
*
|
|
63
|
+
* @param { HTMLElement } container The element that was previously registered via `registerInvisibleMessageRegion`.
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
const deregisterInvisibleMessageRegion = (container) => {
|
|
67
|
+
const index = regions.findIndex(region => region.container === container);
|
|
68
|
+
if (index === -1) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const [region] = regions.splice(index, 1);
|
|
72
|
+
region.spans.polite.remove();
|
|
73
|
+
region.spans.assertive.remove();
|
|
74
|
+
};
|
|
31
75
|
/**
|
|
32
76
|
* Inserts the string into the respective span, depending on the mode provided.
|
|
33
77
|
*
|
|
@@ -36,8 +80,15 @@ attachBoot(() => {
|
|
|
36
80
|
* @public
|
|
37
81
|
*/
|
|
38
82
|
const announce = (message, mode) => {
|
|
83
|
+
let target = defaultSpans;
|
|
84
|
+
for (let i = regions.length - 1; i >= 0; i--) {
|
|
85
|
+
if (regions[i].container.isConnected) {
|
|
86
|
+
target = regions[i].spans;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
39
90
|
// If no type is presented, fallback to polite announcement.
|
|
40
|
-
const span = mode === InvisibleMessageMode.Assertive ?
|
|
91
|
+
const span = mode === InvisibleMessageMode.Assertive ? target.assertive : target.polite;
|
|
41
92
|
// Set textContent to empty string in order to trigger screen reader's announcement.
|
|
42
93
|
span.textContent = "";
|
|
43
94
|
span.textContent = message;
|
|
@@ -53,4 +104,5 @@ const announce = (message, mode) => {
|
|
|
53
104
|
}, 3000);
|
|
54
105
|
};
|
|
55
106
|
export default announce;
|
|
107
|
+
export { registerInvisibleMessageRegion, deregisterInvisibleMessageRegion, };
|
|
56
108
|
//# sourceMappingURL=InvisibleMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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;
|
|
1
|
+
{"version":3,"file":"InvisibleMessage.js","sourceRoot":"","sources":["../../src/util/InvisibleMessage.ts"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BAA8B,EAC9B,gCAAgC,GAChC,CAAC","sourcesContent":["import InvisibleMessageMode from \"../types/InvisibleMessageMode.js\";\nimport getSingletonElementInstance from \"./getSingletonElementInstance.js\";\nimport { attachBoot } from \"../Boot.js\";\n\ntype AnnouncementSpans = {\n\tpolite: HTMLElement;\n\tassertive: HTMLElement;\n};\n\nlet defaultSpans: AnnouncementSpans;\n\nconst regions: Array<{ container: HTMLElement, spans: AnnouncementSpans }> = [];\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\n/**\n * Creates a pair of off-viewport aria-live spans (polite and assertive) to be used for screen reader announcements.\n */\nconst createAnnouncementSpans = (): AnnouncementSpans => {\n\tconst politeSpan = document.createElement(\"span\");\n\tconst assertiveSpan = 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\treturn { polite: politeSpan, assertive: assertiveSpan };\n};\n\nattachBoot(() => {\n\tif (defaultSpans) {\n\t\treturn;\n\t}\n\n\tdefaultSpans = createAnnouncementSpans();\n\n\tconst announcementArea = getSingletonElementInstance(\"ui5-announcement-area\");\n\tannouncementArea.appendChild(defaultSpans.polite);\n\tannouncementArea.appendChild(defaultSpans.assertive);\n});\n\n/**\n * Registers an element as an aria-live region container. A pair of hidden aria-live spans (polite and assertive)\n * is created inside the provided container, and subsequent announcements are routed there while it stays registered.\n *\n * This is used to render the aria-live region inside a dialog/popover, so that announcements made while a modal\n * popup is open (and the screen reader's accessibility tree is scoped to the popup's subtree) are still read out.\n *\n * @param { HTMLElement } container The element that will host the aria-live spans.\n * @public\n */\nconst registerInvisibleMessageRegion = (container: HTMLElement) => {\n\tif (regions.some(region => region.container === container)) {\n\t\treturn;\n\t}\n\n\tconst spans = createAnnouncementSpans();\n\tcontainer.appendChild(spans.polite);\n\tcontainer.appendChild(spans.assertive);\n\n\tregions.push({ container, spans });\n};\n\n/**\n * Deregisters a previously registered aria-live region container, removing its aria-live spans.\n * After deregistration, announcements are routed to the next registered region, or to the default\n * body-level region if none remain.\n *\n * @param { HTMLElement } container The element that was previously registered via `registerInvisibleMessageRegion`.\n * @public\n */\nconst deregisterInvisibleMessageRegion = (container: HTMLElement) => {\n\tconst index = regions.findIndex(region => region.container === container);\n\tif (index === -1) {\n\t\treturn;\n\t}\n\n\tconst [region] = regions.splice(index, 1);\n\tregion.spans.polite.remove();\n\tregion.spans.assertive.remove();\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\tlet target = defaultSpans;\n\tfor (let i = regions.length - 1; i >= 0; i--) {\n\t\tif (regions[i].container.isConnected) {\n\t\t\ttarget = regions[i].spans;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// If no type is presented, fallback to polite announcement.\n\tconst span = mode === InvisibleMessageMode.Assertive ? target.assertive : target.polite;\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;\nexport {\n\tregisterInvisibleMessageRegion,\n\tderegisterInvisibleMessageRegion,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "2.26.0-rc.
|
|
3
|
+
"version": "2.26.0-rc.1",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
66
|
-
"@openui5/sap.ui.core": "1.
|
|
66
|
+
"@openui5/sap.ui.core": "1.151.0",
|
|
67
67
|
"@sap-theming/theming-base-content": "11.36.4",
|
|
68
68
|
"@ui5/cypress-internal": "0.1.0",
|
|
69
|
-
"@ui5/webcomponents-tools": "2.26.0-rc.
|
|
69
|
+
"@ui5/webcomponents-tools": "2.26.0-rc.1",
|
|
70
70
|
"clean-css": "^5.2.2",
|
|
71
71
|
"cypress": "15.18.1",
|
|
72
72
|
"mocha": "^11.7.2",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"customElements": "dist/custom-elements.json",
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "5a9a30101e46d6a525886f4dadebdbf85a6afceb"
|
|
89
89
|
}
|