1 /******/ (function() { // webpackBootstrap |
1 /******/ (() => { // webpackBootstrap |
2 /******/ "use strict"; |
2 /******/ "use strict"; |
3 /******/ // The require scope |
3 /******/ // The require scope |
4 /******/ var __webpack_require__ = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /************************************************************************/ |
6 /************************************************************************/ |
7 /******/ /* webpack/runtime/compat get default export */ |
7 /******/ /* webpack/runtime/compat get default export */ |
8 /******/ !function() { |
8 /******/ (() => { |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
10 /******/ __webpack_require__.n = function(module) { |
10 /******/ __webpack_require__.n = (module) => { |
11 /******/ var getter = module && module.__esModule ? |
11 /******/ var getter = module && module.__esModule ? |
12 /******/ function() { return module['default']; } : |
12 /******/ () => (module['default']) : |
13 /******/ function() { return module; }; |
13 /******/ () => (module); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
15 /******/ return getter; |
15 /******/ return getter; |
16 /******/ }; |
16 /******/ }; |
17 /******/ }(); |
17 /******/ })(); |
18 /******/ |
18 /******/ |
19 /******/ /* webpack/runtime/define property getters */ |
19 /******/ /* webpack/runtime/define property getters */ |
20 /******/ !function() { |
20 /******/ (() => { |
21 /******/ // define getter functions for harmony exports |
21 /******/ // define getter functions for harmony exports |
22 /******/ __webpack_require__.d = function(exports, definition) { |
22 /******/ __webpack_require__.d = (exports, definition) => { |
23 /******/ for(var key in definition) { |
23 /******/ for(var key in definition) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
26 /******/ } |
26 /******/ } |
27 /******/ } |
27 /******/ } |
28 /******/ }; |
28 /******/ }; |
29 /******/ }(); |
29 /******/ })(); |
30 /******/ |
30 /******/ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
32 /******/ !function() { |
32 /******/ (() => { |
33 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
34 /******/ }(); |
34 /******/ })(); |
35 /******/ |
35 /******/ |
36 /******/ /* webpack/runtime/make namespace object */ |
36 /******/ /* webpack/runtime/make namespace object */ |
37 /******/ !function() { |
37 /******/ (() => { |
38 /******/ // define __esModule on exports |
38 /******/ // define __esModule on exports |
39 /******/ __webpack_require__.r = function(exports) { |
39 /******/ __webpack_require__.r = (exports) => { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
42 /******/ } |
42 /******/ } |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
44 /******/ }; |
44 /******/ }; |
45 /******/ }(); |
45 /******/ })(); |
46 /******/ |
46 /******/ |
47 /************************************************************************/ |
47 /************************************************************************/ |
48 var __webpack_exports__ = {}; |
48 var __webpack_exports__ = {}; |
49 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
50 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
51 |
51 |
52 // EXPORTS |
52 // EXPORTS |
53 __webpack_require__.d(__webpack_exports__, { |
53 __webpack_require__.d(__webpack_exports__, { |
54 "setup": function() { return /* binding */ setup; }, |
54 setup: () => (/* binding */ setup), |
55 "speak": function() { return /* binding */ speak; } |
55 speak: () => (/* binding */ speak) |
56 }); |
56 }); |
57 |
57 |
58 ;// CONCATENATED MODULE: external ["wp","domReady"] |
58 ;// CONCATENATED MODULE: external ["wp","domReady"] |
59 var external_wp_domReady_namespaceObject = window["wp"]["domReady"]; |
59 const external_wp_domReady_namespaceObject = window["wp"]["domReady"]; |
60 var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject); |
60 var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject); |
61 ;// CONCATENATED MODULE: external ["wp","i18n"] |
61 ;// CONCATENATED MODULE: external ["wp","i18n"] |
62 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
62 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
63 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js |
63 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js |
64 /** |
64 /** |
65 * WordPress dependencies |
65 * WordPress dependencies |
66 */ |
66 */ |
|
67 |
67 |
68 |
68 /** |
69 /** |
69 * Build the explanatory text to be placed before the aria live regions. |
70 * Build the explanatory text to be placed before the aria live regions. |
70 * |
71 * |
71 * This text is initially hidden from assistive technologies by using a `hidden` |
72 * This text is initially hidden from assistive technologies by using a `hidden` |
72 * HTML attribute which is then removed once a message fills the aria-live regions. |
73 * HTML attribute which is then removed once a message fills the aria-live regions. |
73 * |
74 * |
74 * @return {HTMLParagraphElement} The explanatory text HTML element. |
75 * @return {HTMLParagraphElement} The explanatory text HTML element. |
75 */ |
76 */ |
76 |
|
77 function addIntroText() { |
77 function addIntroText() { |
78 const introText = document.createElement('p'); |
78 const introText = document.createElement('p'); |
79 introText.id = 'a11y-speak-intro-text'; |
79 introText.id = 'a11y-speak-intro-text'; |
80 introText.className = 'a11y-speak-intro-text'; |
80 introText.className = 'a11y-speak-intro-text'; |
81 introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications'); |
81 introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications'); |
82 introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
82 introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
83 introText.setAttribute('hidden', 'hidden'); |
83 introText.setAttribute('hidden', 'hidden'); |
84 const { |
84 const { |
85 body |
85 body |
86 } = document; |
86 } = document; |
87 |
|
88 if (body) { |
87 if (body) { |
89 body.appendChild(introText); |
88 body.appendChild(introText); |
90 } |
89 } |
91 |
|
92 return introText; |
90 return introText; |
93 } |
91 } |
94 |
92 |
95 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js |
93 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js |
96 /** |
94 /** |
98 * |
96 * |
99 * @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'. |
97 * @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'. |
100 * |
98 * |
101 * @return {HTMLDivElement} The ARIA live region HTML element. |
99 * @return {HTMLDivElement} The ARIA live region HTML element. |
102 */ |
100 */ |
103 function addContainer() { |
101 function addContainer(ariaLive = 'polite') { |
104 let ariaLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'polite'; |
|
105 const container = document.createElement('div'); |
102 const container = document.createElement('div'); |
106 container.id = `a11y-speak-${ariaLive}`; |
103 container.id = `a11y-speak-${ariaLive}`; |
107 container.className = 'a11y-speak-region'; |
104 container.className = 'a11y-speak-region'; |
108 container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
105 container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
109 container.setAttribute('aria-live', ariaLive); |
106 container.setAttribute('aria-live', ariaLive); |
110 container.setAttribute('aria-relevant', 'additions text'); |
107 container.setAttribute('aria-relevant', 'additions text'); |
111 container.setAttribute('aria-atomic', 'true'); |
108 container.setAttribute('aria-atomic', 'true'); |
112 const { |
109 const { |
113 body |
110 body |
114 } = document; |
111 } = document; |
115 |
|
116 if (body) { |
112 if (body) { |
117 body.appendChild(container); |
113 body.appendChild(container); |
118 } |
114 } |
119 |
|
120 return container; |
115 return container; |
121 } |
116 } |
122 |
117 |
123 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js |
118 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js |
124 /** |
119 /** |
125 * Clears the a11y-speak-region elements and hides the explanatory text. |
120 * Clears the a11y-speak-region elements and hides the explanatory text. |
126 */ |
121 */ |
127 function clear() { |
122 function clear() { |
128 const regions = document.getElementsByClassName('a11y-speak-region'); |
123 const regions = document.getElementsByClassName('a11y-speak-region'); |
129 const introText = document.getElementById('a11y-speak-intro-text'); |
124 const introText = document.getElementById('a11y-speak-intro-text'); |
130 |
|
131 for (let i = 0; i < regions.length; i++) { |
125 for (let i = 0; i < regions.length; i++) { |
132 regions[i].textContent = ''; |
126 regions[i].textContent = ''; |
133 } // Make sure the explanatory text is hidden from assistive technologies. |
127 } |
134 |
128 |
135 |
129 // Make sure the explanatory text is hidden from assistive technologies. |
136 if (introText) { |
130 if (introText) { |
137 introText.setAttribute('hidden', 'hidden'); |
131 introText.setAttribute('hidden', 'hidden'); |
138 } |
132 } |
139 } |
133 } |
140 |
134 |
141 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js |
135 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js |
142 let previousMessage = ''; |
136 let previousMessage = ''; |
|
137 |
143 /** |
138 /** |
144 * Filter the message to be announced to the screenreader. |
139 * Filter the message to be announced to the screenreader. |
145 * |
140 * |
146 * @param {string} message The message to be announced. |
141 * @param {string} message The message to be announced. |
147 * |
142 * |
148 * @return {string} The filtered message. |
143 * @return {string} The filtered message. |
149 */ |
144 */ |
150 |
|
151 function filterMessage(message) { |
145 function filterMessage(message) { |
152 /* |
146 /* |
153 * Strip HTML tags (if any) from the message string. Ideally, messages should |
147 * Strip HTML tags (if any) from the message string. Ideally, messages should |
154 * be simple strings, carefully crafted for specific use with A11ySpeak. |
148 * be simple strings, carefully crafted for specific use with A11ySpeak. |
155 * When re-using already existing strings this will ensure simple HTML to be |
149 * When re-using already existing strings this will ensure simple HTML to be |
156 * stripped out and replaced with a space. Browsers will collapse multiple |
150 * stripped out and replaced with a space. Browsers will collapse multiple |
157 * spaces natively. |
151 * spaces natively. |
158 */ |
152 */ |
159 message = message.replace(/<[^<>]+>/g, ' '); |
153 message = message.replace(/<[^<>]+>/g, ' '); |
|
154 |
160 /* |
155 /* |
161 * Safari + VoiceOver don't announce repeated, identical strings. We use |
156 * Safari + VoiceOver don't announce repeated, identical strings. We use |
162 * a `no-break space` to force them to think identical strings are different. |
157 * a `no-break space` to force them to think identical strings are different. |
163 */ |
158 */ |
164 |
|
165 if (previousMessage === message) { |
159 if (previousMessage === message) { |
166 message += '\u00A0'; |
160 message += '\u00A0'; |
167 } |
161 } |
168 |
|
169 previousMessage = message; |
162 previousMessage = message; |
170 return message; |
163 return message; |
171 } |
164 } |
172 |
165 |
173 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js |
166 ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js |
174 /** |
167 /** |
175 * WordPress dependencies |
168 * WordPress dependencies |
176 */ |
169 */ |
177 |
170 |
|
171 |
178 /** |
172 /** |
179 * Internal dependencies |
173 * Internal dependencies |
180 */ |
174 */ |
181 |
175 |
182 |
176 |
184 |
178 |
185 |
179 |
186 /** |
180 /** |
187 * Create the live regions. |
181 * Create the live regions. |
188 */ |
182 */ |
189 |
|
190 function setup() { |
183 function setup() { |
191 const introText = document.getElementById('a11y-speak-intro-text'); |
184 const introText = document.getElementById('a11y-speak-intro-text'); |
192 const containerAssertive = document.getElementById('a11y-speak-assertive'); |
185 const containerAssertive = document.getElementById('a11y-speak-assertive'); |
193 const containerPolite = document.getElementById('a11y-speak-polite'); |
186 const containerPolite = document.getElementById('a11y-speak-polite'); |
194 |
|
195 if (introText === null) { |
187 if (introText === null) { |
196 addIntroText(); |
188 addIntroText(); |
197 } |
189 } |
198 |
|
199 if (containerAssertive === null) { |
190 if (containerAssertive === null) { |
200 addContainer('assertive'); |
191 addContainer('assertive'); |
201 } |
192 } |
202 |
|
203 if (containerPolite === null) { |
193 if (containerPolite === null) { |
204 addContainer('polite'); |
194 addContainer('polite'); |
205 } |
195 } |
206 } |
196 } |
|
197 |
207 /** |
198 /** |
208 * Run setup on domReady. |
199 * Run setup on domReady. |
209 */ |
200 */ |
210 |
|
211 external_wp_domReady_default()(setup); |
201 external_wp_domReady_default()(setup); |
|
202 |
212 /** |
203 /** |
213 * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. |
204 * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. |
214 * This module is inspired by the `speak` function in `wp-a11y.js`. |
205 * This module is inspired by the `speak` function in `wp-a11y.js`. |
215 * |
206 * |
216 * @param {string} message The message to be announced by assistive technologies. |
207 * @param {string} message The message to be announced by assistive technologies. |
225 * |
216 * |
226 * // For assertive messages that should interrupt what screen readers are currently announcing. |
217 * // For assertive messages that should interrupt what screen readers are currently announcing. |
227 * speak( 'The message you want to send to the ARIA live region', 'assertive' ); |
218 * speak( 'The message you want to send to the ARIA live region', 'assertive' ); |
228 * ``` |
219 * ``` |
229 */ |
220 */ |
230 |
|
231 function speak(message, ariaLive) { |
221 function speak(message, ariaLive) { |
232 /* |
222 /* |
233 * Clear previous messages to allow repeated strings being read out and hide |
223 * Clear previous messages to allow repeated strings being read out and hide |
234 * the explanatory text from assistive technologies. |
224 * the explanatory text from assistive technologies. |
235 */ |
225 */ |
236 clear(); |
226 clear(); |
237 message = filterMessage(message); |
227 message = filterMessage(message); |
238 const introText = document.getElementById('a11y-speak-intro-text'); |
228 const introText = document.getElementById('a11y-speak-intro-text'); |
239 const containerAssertive = document.getElementById('a11y-speak-assertive'); |
229 const containerAssertive = document.getElementById('a11y-speak-assertive'); |
240 const containerPolite = document.getElementById('a11y-speak-polite'); |
230 const containerPolite = document.getElementById('a11y-speak-polite'); |
241 |
|
242 if (containerAssertive && ariaLive === 'assertive') { |
231 if (containerAssertive && ariaLive === 'assertive') { |
243 containerAssertive.textContent = message; |
232 containerAssertive.textContent = message; |
244 } else if (containerPolite) { |
233 } else if (containerPolite) { |
245 containerPolite.textContent = message; |
234 containerPolite.textContent = message; |
246 } |
235 } |
|
236 |
247 /* |
237 /* |
248 * Make the explanatory text available to assistive technologies by removing |
238 * Make the explanatory text available to assistive technologies by removing |
249 * the 'hidden' HTML attribute. |
239 * the 'hidden' HTML attribute. |
250 */ |
240 */ |
251 |
|
252 |
|
253 if (introText) { |
241 if (introText) { |
254 introText.removeAttribute('hidden'); |
242 introText.removeAttribute('hidden'); |
255 } |
243 } |
256 } |
244 } |
257 |
245 |