2024-01-31 07:59:56 -05:00
|
|
|
/******/ (() => { // webpackBootstrap
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ "use strict";
|
|
|
|
/******/ // The require scope
|
|
|
|
/******/ var __webpack_require__ = {};
|
|
|
|
/******/
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ /* webpack/runtime/compat get default export */
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ (() => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ __webpack_require__.n = (module) => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ var getter = module && module.__esModule ?
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ () => (module['default']) :
|
|
|
|
/******/ () => (module);
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ __webpack_require__.d(getter, { a: getter });
|
|
|
|
/******/ return getter;
|
|
|
|
/******/ };
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ })();
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/define property getters */
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ (() => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ // define getter functions for harmony exports
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ __webpack_require__.d = (exports, definition) => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ for(var key in definition) {
|
|
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
|
|
/******/ }
|
|
|
|
/******/ }
|
2018-12-13 23:41:57 -05:00
|
|
|
/******/ };
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ })();
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ (() => {
|
|
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
|
|
/******/ })();
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/make namespace object */
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ (() => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ // define __esModule on exports
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ __webpack_require__.r = (exports) => {
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
/******/ };
|
2024-01-31 07:59:56 -05:00
|
|
|
/******/ })();
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/
|
2018-12-13 23:41:57 -05:00
|
|
|
/************************************************************************/
|
2022-04-11 08:04:30 -04:00
|
|
|
var __webpack_exports__ = {};
|
2020-06-29 07:50:29 -04:00
|
|
|
// ESM COMPAT FLAG
|
2018-12-13 23:41:57 -05:00
|
|
|
__webpack_require__.r(__webpack_exports__);
|
2018-12-17 22:14:52 -05:00
|
|
|
|
2020-06-29 07:50:29 -04:00
|
|
|
// EXPORTS
|
2022-04-11 08:04:30 -04:00
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
2024-01-31 07:59:56 -05:00
|
|
|
setup: () => (/* binding */ setup),
|
|
|
|
speak: () => (/* binding */ speak)
|
2022-04-11 08:04:30 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: external ["wp","domReady"]
|
2024-01-31 07:59:56 -05:00
|
|
|
const external_wp_domReady_namespaceObject = window["wp"]["domReady"];
|
2022-04-11 08:04:30 -04:00
|
|
|
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject);
|
|
|
|
;// CONCATENATED MODULE: external ["wp","i18n"]
|
2024-01-31 07:59:56 -05:00
|
|
|
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
|
2022-04-11 08:04:30 -04:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js
|
2020-06-26 09:33:47 -04:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2020-06-26 09:33:47 -04:00
|
|
|
/**
|
|
|
|
* Build the explanatory text to be placed before the aria live regions.
|
|
|
|
*
|
|
|
|
* This text is initially hidden from assistive technologies by using a `hidden`
|
|
|
|
* HTML attribute which is then removed once a message fills the aria-live regions.
|
|
|
|
*
|
|
|
|
* @return {HTMLParagraphElement} The explanatory text HTML element.
|
|
|
|
*/
|
|
|
|
function addIntroText() {
|
2021-05-19 11:09:27 -04:00
|
|
|
const introText = document.createElement('p');
|
2020-06-26 09:33:47 -04:00
|
|
|
introText.id = 'a11y-speak-intro-text';
|
|
|
|
introText.className = 'a11y-speak-intro-text';
|
2022-04-11 08:04:30 -04:00
|
|
|
introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications');
|
2020-06-26 09:33:47 -04:00
|
|
|
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;');
|
|
|
|
introText.setAttribute('hidden', 'hidden');
|
2021-05-19 11:09:27 -04:00
|
|
|
const {
|
|
|
|
body
|
|
|
|
} = document;
|
2020-06-26 09:33:47 -04:00
|
|
|
if (body) {
|
|
|
|
body.appendChild(introText);
|
|
|
|
}
|
|
|
|
return introText;
|
|
|
|
}
|
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
|
|
|
* Build the live regions markup.
|
|
|
|
*
|
2020-06-26 09:33:47 -04:00
|
|
|
* @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'.
|
2018-12-13 23:41:57 -05:00
|
|
|
*
|
2020-01-22 17:06:21 -05:00
|
|
|
* @return {HTMLDivElement} The ARIA live region HTML element.
|
2018-12-13 23:41:57 -05:00
|
|
|
*/
|
2023-06-27 10:24:19 -04:00
|
|
|
function addContainer(ariaLive = 'polite') {
|
2021-05-19 11:09:27 -04:00
|
|
|
const container = document.createElement('div');
|
|
|
|
container.id = `a11y-speak-${ariaLive}`;
|
2018-12-13 23:41:57 -05:00
|
|
|
container.className = 'a11y-speak-region';
|
|
|
|
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;');
|
|
|
|
container.setAttribute('aria-live', ariaLive);
|
|
|
|
container.setAttribute('aria-relevant', 'additions text');
|
|
|
|
container.setAttribute('aria-atomic', 'true');
|
2021-05-19 11:09:27 -04:00
|
|
|
const {
|
|
|
|
body
|
|
|
|
} = document;
|
2020-01-22 17:06:21 -05:00
|
|
|
if (body) {
|
|
|
|
body.appendChild(container);
|
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
return container;
|
2020-06-26 09:33:47 -04:00
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
2020-06-26 09:33:47 -04:00
|
|
|
* Clears the a11y-speak-region elements and hides the explanatory text.
|
2018-12-13 23:41:57 -05:00
|
|
|
*/
|
2020-06-26 09:33:47 -04:00
|
|
|
function clear() {
|
2021-05-19 11:09:27 -04:00
|
|
|
const regions = document.getElementsByClassName('a11y-speak-region');
|
|
|
|
const introText = document.getElementById('a11y-speak-intro-text');
|
|
|
|
for (let i = 0; i < regions.length; i++) {
|
2018-12-13 23:41:57 -05:00
|
|
|
regions[i].textContent = '';
|
2023-09-26 10:23:26 -04:00
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2023-09-26 10:23:26 -04:00
|
|
|
// Make sure the explanatory text is hidden from assistive technologies.
|
2020-06-26 09:33:47 -04:00
|
|
|
if (introText) {
|
|
|
|
introText.setAttribute('hidden', 'hidden');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js
|
2021-05-19 11:09:27 -04:00
|
|
|
let previousMessage = '';
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
|
|
|
* Filter the message to be announced to the screenreader.
|
|
|
|
*
|
|
|
|
* @param {string} message The message to be announced.
|
|
|
|
*
|
|
|
|
* @return {string} The filtered message.
|
|
|
|
*/
|
2020-06-26 09:33:47 -04:00
|
|
|
function filterMessage(message) {
|
2018-12-13 23:41:57 -05:00
|
|
|
/*
|
|
|
|
* Strip HTML tags (if any) from the message string. Ideally, messages should
|
|
|
|
* be simple strings, carefully crafted for specific use with A11ySpeak.
|
|
|
|
* When re-using already existing strings this will ensure simple HTML to be
|
|
|
|
* stripped out and replaced with a space. Browsers will collapse multiple
|
|
|
|
* spaces natively.
|
|
|
|
*/
|
|
|
|
message = message.replace(/<[^<>]+>/g, ' ');
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2020-06-26 09:33:47 -04:00
|
|
|
/*
|
|
|
|
* Safari + VoiceOver don't announce repeated, identical strings. We use
|
|
|
|
* a `no-break space` to force them to think identical strings are different.
|
|
|
|
*/
|
2018-12-13 23:41:57 -05:00
|
|
|
if (previousMessage === message) {
|
2021-05-19 11:09:27 -04:00
|
|
|
message += '\u00A0';
|
2018-12-13 23:41:57 -05:00
|
|
|
}
|
|
|
|
previousMessage = message;
|
|
|
|
return message;
|
2020-06-26 09:33:47 -04:00
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js
|
2019-03-07 04:09:59 -05:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2019-03-07 04:09:59 -05:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-12-13 23:41:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-26 09:33:47 -04:00
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
|
|
|
* Create the live regions.
|
|
|
|
*/
|
2020-06-26 09:33:47 -04:00
|
|
|
function setup() {
|
2021-05-19 11:09:27 -04:00
|
|
|
const introText = document.getElementById('a11y-speak-intro-text');
|
|
|
|
const containerAssertive = document.getElementById('a11y-speak-assertive');
|
|
|
|
const containerPolite = document.getElementById('a11y-speak-polite');
|
2020-06-26 09:33:47 -04:00
|
|
|
if (introText === null) {
|
|
|
|
addIntroText();
|
2018-12-13 23:41:57 -05:00
|
|
|
}
|
|
|
|
if (containerAssertive === null) {
|
2020-06-26 09:33:47 -04:00
|
|
|
addContainer('assertive');
|
2018-12-13 23:41:57 -05:00
|
|
|
}
|
2020-06-26 09:33:47 -04:00
|
|
|
if (containerPolite === null) {
|
|
|
|
addContainer('polite');
|
|
|
|
}
|
|
|
|
}
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
|
|
|
* Run setup on domReady.
|
|
|
|
*/
|
2021-01-27 21:04:13 -05:00
|
|
|
external_wp_domReady_default()(setup);
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
2019-03-21 08:48:00 -04:00
|
|
|
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.
|
2020-06-26 09:33:47 -04:00
|
|
|
* This module is inspired by the `speak` function in `wp-a11y.js`.
|
2018-12-13 23:41:57 -05:00
|
|
|
*
|
2021-11-08 09:29:21 -05:00
|
|
|
* @param {string} message The message to be announced by assistive technologies.
|
2020-06-26 09:33:47 -04:00
|
|
|
* @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'.
|
2019-03-21 08:48:00 -04:00
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* import { speak } from '@wordpress/a11y';
|
|
|
|
*
|
|
|
|
* // For polite messages that shouldn't interrupt what screen readers are currently announcing.
|
|
|
|
* speak( 'The message you want to send to the ARIA live region' );
|
|
|
|
*
|
|
|
|
* // For assertive messages that should interrupt what screen readers are currently announcing.
|
|
|
|
* speak( 'The message you want to send to the ARIA live region', 'assertive' );
|
|
|
|
* ```
|
2018-12-13 23:41:57 -05:00
|
|
|
*/
|
2020-06-26 09:33:47 -04:00
|
|
|
function speak(message, ariaLive) {
|
|
|
|
/*
|
|
|
|
* Clear previous messages to allow repeated strings being read out and hide
|
|
|
|
* the explanatory text from assistive technologies.
|
|
|
|
*/
|
|
|
|
clear();
|
|
|
|
message = filterMessage(message);
|
2021-05-19 11:09:27 -04:00
|
|
|
const introText = document.getElementById('a11y-speak-intro-text');
|
|
|
|
const containerAssertive = document.getElementById('a11y-speak-assertive');
|
|
|
|
const containerPolite = document.getElementById('a11y-speak-polite');
|
2020-06-26 09:33:47 -04:00
|
|
|
if (containerAssertive && ariaLive === 'assertive') {
|
2018-12-13 23:41:57 -05:00
|
|
|
containerAssertive.textContent = message;
|
|
|
|
} else if (containerPolite) {
|
|
|
|
containerPolite.textContent = message;
|
|
|
|
}
|
2023-09-26 10:23:26 -04:00
|
|
|
|
2020-06-26 09:33:47 -04:00
|
|
|
/*
|
|
|
|
* Make the explanatory text available to assistive technologies by removing
|
|
|
|
* the 'hidden' HTML attribute.
|
|
|
|
*/
|
|
|
|
if (introText) {
|
|
|
|
introText.removeAttribute('hidden');
|
|
|
|
}
|
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
(window.wp = window.wp || {}).a11y = __webpack_exports__;
|
|
|
|
/******/ })()
|
|
|
|
;
|