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