2018-12-13 23:41:57 -05:00
|
|
|
this["wp"] = this["wp"] || {}; this["wp"]["a11y"] =
|
|
|
|
/******/ (function(modules) { // webpackBootstrap
|
|
|
|
/******/ // The module cache
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
/******/
|
|
|
|
/******/ // The require function
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
/******/ if(installedModules[moduleId]) {
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ }
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
/******/ i: moduleId,
|
|
|
|
/******/ l: false,
|
|
|
|
/******/ exports: {}
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Execute the module function
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
/******/ module.l = true;
|
|
|
|
/******/
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
/******/ return module.exports;
|
|
|
|
/******/ }
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/
|
|
|
|
/******/ // expose the module cache
|
|
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/
|
|
|
|
/******/ // define getter function for harmony exports
|
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
/******/ }
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // define __esModule on exports
|
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // create a fake namespace object
|
|
|
|
/******/ // mode & 1: value is a module id, require it
|
|
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
|
|
/******/ // mode & 4: return value when already ns object
|
|
|
|
/******/ // mode & 8|1: behave like require
|
|
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
|
|
/******/ if(mode & 8) return value;
|
|
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
|
|
/******/ var ns = Object.create(null);
|
|
|
|
/******/ __webpack_require__.r(ns);
|
|
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
|
|
/******/ return ns;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
|
|
/******/ __webpack_require__.n = function(module) {
|
|
|
|
/******/ var getter = module && module.__esModule ?
|
|
|
|
/******/ function getDefault() { return module['default']; } :
|
|
|
|
/******/ function getModuleExports() { return module; };
|
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
|
|
/******/ return getter;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
|
|
/******/
|
|
|
|
/******/ // __webpack_public_path__
|
|
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // Load entry module and return exports
|
2021-05-20 08:20:04 -04:00
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = "jncB");
|
2018-12-13 23:41:57 -05:00
|
|
|
/******/ })
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ ({
|
|
|
|
|
2021-05-20 08:20:04 -04:00
|
|
|
/***/ "Y8OO":
|
2018-12-17 22:14:52 -05:00
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2021-01-27 21:04:13 -05:00
|
|
|
(function() { module.exports = window["wp"]["domReady"]; }());
|
2018-12-17 22:14:52 -05:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2021-05-20 08:20:04 -04:00
|
|
|
/***/ "jncB":
|
2018-12-13 23:41:57 -05:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
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
|
|
|
|
__webpack_require__.d(__webpack_exports__, "setup", function() { return /* binding */ setup; });
|
|
|
|
__webpack_require__.d(__webpack_exports__, "speak", function() { return /* binding */ speak; });
|
|
|
|
|
2021-01-27 21:04:13 -05:00
|
|
|
// EXTERNAL MODULE: external ["wp","domReady"]
|
2021-05-20 08:20:04 -04:00
|
|
|
var external_wp_domReady_ = __webpack_require__("Y8OO");
|
2021-01-27 21:04:13 -05:00
|
|
|
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_);
|
2019-03-07 04:09:59 -05:00
|
|
|
|
2021-01-27 21:04:13 -05:00
|
|
|
// EXTERNAL MODULE: external ["wp","i18n"]
|
2021-05-20 08:20:04 -04:00
|
|
|
var external_wp_i18n_ = __webpack_require__("l3Sj");
|
2020-06-26 09:33:47 -04:00
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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';
|
2021-01-27 21:04:13 -05:00
|
|
|
introText.textContent = Object(external_wp_i18n_["__"])('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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
*/
|
2021-11-15 07:50:17 -05:00
|
|
|
function addContainer() {
|
|
|
|
let ariaLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '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
|
|
|
|
2018-12-17 22:14:52 -05: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');
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2021-05-19 11:09:27 -04:00
|
|
|
for (let i = 0; i < regions.length; i++) {
|
2018-12-13 23:41:57 -05:00
|
|
|
regions[i].textContent = '';
|
2020-06-26 09:33:47 -04:00
|
|
|
} // Make sure the explanatory text is hidden from assistive technologies.
|
2018-12-13 23:41:57 -05:00
|
|
|
|
|
|
|
|
2020-06-26 09:33:47 -04:00
|
|
|
if (introText) {
|
|
|
|
introText.setAttribute('hidden', 'hidden');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js
|
2021-05-19 11:09:27 -04:00
|
|
|
let previousMessage = '';
|
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, ' ');
|
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
|
|
|
|
2018-12-17 22:14:52 -05:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js
|
2019-03-07 04:09:59 -05:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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');
|
2018-12-13 23:41:57 -05:00
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
}
|
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);
|
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');
|
2018-12-13 23:41:57 -05:00
|
|
|
|
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;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
2021-05-20 08:20:04 -04:00
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "l3Sj":
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = window["wp"]["i18n"]; }());
|
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/***/ })
|
|
|
|
|
2018-12-17 22:14:52 -05:00
|
|
|
/******/ });
|