@wordpress/a11y 4.33.1 → 4.34.1-next.2f1c7c01b.0

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.34.0 (2025-10-29)
6
+
5
7
  ## 4.33.0 (2025-10-17)
6
8
 
7
9
  ## 4.32.0 (2025-10-01)
package/build/index.js CHANGED
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/a11y/src/index.js
29
31
  var index_exports = {};
30
32
  __export(index_exports, {
31
33
  setup: () => setup,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport domReady from '@wordpress/dom-ready';\n\n/**\n * Internal dependencies\n */\nimport addContainer from './script/add-container';\nimport addIntroText from './script/add-intro-text';\n\nexport { speak } from './shared/index';\n\n/**\n * Create the live regions.\n */\nexport function setup() {\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\tconst containerAssertive = document.getElementById(\n\t\t'a11y-speak-assertive'\n\t);\n\tconst containerPolite = document.getElementById( 'a11y-speak-polite' );\n\n\tif ( introText === null ) {\n\t\taddIntroText();\n\t}\n\n\tif ( containerAssertive === null ) {\n\t\taddContainer( 'assertive' );\n\t}\n\n\tif ( containerPolite === null ) {\n\t\taddContainer( 'polite' );\n\t}\n}\n\n/**\n * Run setup on domReady.\n */\ndomReady( setup );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAqB;AAKrB,2BAAyB;AACzB,4BAAyB;AAEzB,oBAAsB;AAKf,SAAS,QAAQ;AACvB,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,cAAc,MAAO;AACzB,8BAAAA,SAAa;AAAA,EACd;AAEA,MAAK,uBAAuB,MAAO;AAClC,6BAAAC,SAAc,WAAY;AAAA,EAC3B;AAEA,MAAK,oBAAoB,MAAO;AAC/B,6BAAAA,SAAc,QAAS;AAAA,EACxB;AACD;AAAA,IAKA,iBAAAC,SAAU,KAAM;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAqB;AAKrB,2BAAyB;AACzB,4BAAyB;AAEzB,oBAAsB;AAKf,SAAS,QAAQ;AACvB,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,cAAc,MAAO;AACzB,8BAAAA,SAAa;AAAA,EACd;AAEA,MAAK,uBAAuB,MAAO;AAClC,6BAAAC,SAAc,WAAY;AAAA,EAC3B;AAEA,MAAK,oBAAoB,MAAO;AAC/B,6BAAAA,SAAc,QAAS;AAAA,EACxB;AACD;AAAA,IAKA,iBAAAC,SAAU,KAAM;",
6
6
  "names": ["addIntroText", "addContainer", "domReady"]
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/a11y/src/module/index.ts
19
21
  var module_exports = {};
20
22
  __export(module_exports, {
21
23
  setup: () => setup,
@@ -23,7 +25,7 @@ __export(module_exports, {
23
25
  });
24
26
  module.exports = __toCommonJS(module_exports);
25
27
  var import_shared = require("../shared/index");
26
- const setup = () => {
28
+ var setup = () => {
27
29
  };
28
30
  // Annotate the CommonJS export names for ESM import in node:
29
31
  0 && (module.exports = {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/module/index.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nexport { speak } from '../shared/index';\n\n/**\n * This no-op function is exported to provide compatibility with the `wp-a11y` Script.\n *\n * Filters should inject the relevant HTML on page load instead of requiring setup.\n */\nexport const setup = () => {};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAsB;AAOf,MAAM,QAAQ,MAAM;AAAC;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAsB;AAOf,IAAM,QAAQ,MAAM;AAAC;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/a11y/src/script/add-container.js
19
21
  var add_container_exports = {};
20
22
  __export(add_container_exports, {
21
23
  default: () => addContainer
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/script/add-container.js"],
4
4
  "sourcesContent": ["/**\n * Build the live regions markup.\n *\n * @param {'polite'|'assertive'} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'.\n *\n * @return {HTMLDivElement} The ARIA live region HTML element.\n */\nexport default function addContainer( ariaLive = 'polite' ) {\n\tconst container = document.createElement( 'div' );\n\tcontainer.id = `a11y-speak-${ ariaLive }`;\n\tcontainer.className = 'a11y-speak-region';\n\n\tcontainer.setAttribute(\n\t\t'style',\n\t\t'position:absolute;' +\n\t\t\t'margin:-1px;' +\n\t\t\t'padding:0;' +\n\t\t\t'height:1px;' +\n\t\t\t'width:1px;' +\n\t\t\t'overflow:hidden;' +\n\t\t\t'clip-path:inset(50%);' +\n\t\t\t'border:0;' +\n\t\t\t'word-wrap:normal !important;'\n\t);\n\tcontainer.setAttribute( 'aria-live', ariaLive );\n\tcontainer.setAttribute( 'aria-relevant', 'additions text' );\n\tcontainer.setAttribute( 'aria-atomic', 'true' );\n\n\tconst { body } = document;\n\tif ( body ) {\n\t\tbody.appendChild( container );\n\t}\n\n\treturn container;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,aAA+B,WAAW,UAAW;AAC3D,QAAM,YAAY,SAAS,cAAe,KAAM;AAChD,YAAU,KAAK,cAAe,QAAS;AACvC,YAAU,YAAY;AAEtB,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,aAAa,QAAS;AAC9C,YAAU,aAAc,iBAAiB,gBAAiB;AAC1D,YAAU,aAAc,eAAe,MAAO;AAE9C,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,aAA+B,WAAW,UAAW;AAC3D,QAAM,YAAY,SAAS,cAAe,KAAM;AAChD,YAAU,KAAK,cAAe,QAAS;AACvC,YAAU,YAAY;AAEtB,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,aAAa,QAAS;AAC9C,YAAU,aAAc,iBAAiB,gBAAiB;AAC1D,YAAU,aAAc,eAAe,MAAO;AAE9C,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/a11y/src/script/add-intro-text.ts
19
21
  var add_intro_text_exports = {};
20
22
  __export(add_intro_text_exports, {
21
23
  default: () => addIntroText
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/script/add-intro-text.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Build the explanatory text to be placed before the aria live regions.\n *\n * This text is initially hidden from assistive technologies by using a `hidden`\n * HTML attribute which is then removed once a message fills the aria-live regions.\n *\n * @return {HTMLParagraphElement} The explanatory text HTML element.\n */\nexport default function addIntroText() {\n\tconst introText = document.createElement( 'p' );\n\n\tintroText.id = 'a11y-speak-intro-text';\n\tintroText.className = 'a11y-speak-intro-text';\n\tintroText.textContent = __( 'Notifications' );\n\n\tintroText.setAttribute(\n\t\t'style',\n\t\t'position:absolute;' +\n\t\t\t'margin:-1px;' +\n\t\t\t'padding:0;' +\n\t\t\t'height:1px;' +\n\t\t\t'width:1px;' +\n\t\t\t'overflow:hidden;' +\n\t\t\t'clip-path:inset(50%);' +\n\t\t\t'border:0;' +\n\t\t\t'word-wrap:normal !important;'\n\t);\n\tintroText.setAttribute( 'hidden', '' );\n\n\tconst { body } = document;\n\tif ( body ) {\n\t\tbody.appendChild( introText );\n\t}\n\n\treturn introText;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAUJ,SAAR,eAAgC;AACtC,QAAM,YAAY,SAAS,cAAe,GAAI;AAE9C,YAAU,KAAK;AACf,YAAU,YAAY;AACtB,YAAU,kBAAc,gBAAI,eAAgB;AAE5C,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,UAAU,EAAG;AAErC,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAUJ,SAAR,eAAgC;AACtC,QAAM,YAAY,SAAS,cAAe,GAAI;AAE9C,YAAU,KAAK;AACf,YAAU,YAAY;AACtB,YAAU,kBAAc,gBAAI,eAAgB;AAE5C,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,UAAU,EAAG;AAErC,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/a11y/src/shared/clear.js
19
21
  var clear_exports = {};
20
22
  __export(clear_exports, {
21
23
  default: () => clear
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/clear.js"],
4
4
  "sourcesContent": ["/**\n * Clears the a11y-speak-region elements and hides the explanatory text.\n */\nexport default function clear() {\n\tconst regions = document.getElementsByClassName( 'a11y-speak-region' );\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\n\tfor ( let i = 0; i < regions.length; i++ ) {\n\t\tregions[ i ].textContent = '';\n\t}\n\n\t// Make sure the explanatory text is hidden from assistive technologies.\n\tif ( introText ) {\n\t\tintroText.setAttribute( 'hidden', 'hidden' );\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGe,SAAR,QAAyB;AAC/B,QAAM,UAAU,SAAS,uBAAwB,mBAAoB;AACrE,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AAEnE,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,YAAS,CAAE,EAAE,cAAc;AAAA,EAC5B;AAGA,MAAK,WAAY;AAChB,cAAU,aAAc,UAAU,QAAS;AAAA,EAC5C;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGe,SAAR,QAAyB;AAC/B,QAAM,UAAU,SAAS,uBAAwB,mBAAoB;AACrE,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AAEnE,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,YAAS,CAAE,EAAE,cAAc;AAAA,EAC5B;AAGA,MAAK,WAAY;AAChB,cAAU,aAAc,UAAU,QAAS;AAAA,EAC5C;AACD;",
6
6
  "names": []
7
7
  }
@@ -16,12 +16,14 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/a11y/src/shared/filter-message.js
19
21
  var filter_message_exports = {};
20
22
  __export(filter_message_exports, {
21
23
  default: () => filterMessage
22
24
  });
23
25
  module.exports = __toCommonJS(filter_message_exports);
24
- let previousMessage = "";
26
+ var previousMessage = "";
25
27
  function filterMessage(message) {
26
28
  message = message.replace(/<[^<>]+>/g, " ");
27
29
  if (previousMessage === message) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/filter-message.js"],
4
4
  "sourcesContent": ["let previousMessage = '';\n\n/**\n * Filter the message to be announced to the screenreader.\n *\n * @param {string} message The message to be announced.\n *\n * @return {string} The filtered message.\n */\nexport default function filterMessage( message ) {\n\t/*\n\t * Strip HTML tags (if any) from the message string. Ideally, messages should\n\t * be simple strings, carefully crafted for specific use with A11ySpeak.\n\t * When re-using already existing strings this will ensure simple HTML to be\n\t * stripped out and replaced with a space. Browsers will collapse multiple\n\t * spaces natively.\n\t */\n\tmessage = message.replace( /<[^<>]+>/g, ' ' );\n\n\t/*\n\t * Safari + VoiceOver don't announce repeated, identical strings. We use\n\t * a `no-break space` to force them to think identical strings are different.\n\t */\n\tif ( previousMessage === message ) {\n\t\tmessage += '\\u00A0';\n\t}\n\n\tpreviousMessage = message;\n\n\treturn message;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAI,kBAAkB;AASP,SAAR,cAAgC,SAAU;AAQhD,YAAU,QAAQ,QAAS,aAAa,GAAI;AAM5C,MAAK,oBAAoB,SAAU;AAClC,eAAW;AAAA,EACZ;AAEA,oBAAkB;AAElB,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAI,kBAAkB;AASP,SAAR,cAAgC,SAAU;AAQhD,YAAU,QAAQ,QAAS,aAAa,GAAI;AAM5C,MAAK,oBAAoB,SAAU;AAClC,eAAW;AAAA,EACZ;AAEA,oBAAkB;AAElB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/a11y/src/shared/index.js
29
31
  var shared_exports = {};
30
32
  __export(shared_exports, {
31
33
  speak: () => speak
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/index.js"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport clear from './clear';\nimport filterMessage from './filter-message';\n\n/**\n * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.\n * This module is inspired by the `speak` function in `wp-a11y.js`.\n *\n * @param {string} message The message to be announced by assistive technologies.\n * @param {'polite'|'assertive'} [ariaLive] The politeness level for aria-live; default: 'polite'.\n *\n * @example\n * ```js\n * import { speak } from '@wordpress/a11y';\n *\n * // For polite messages that shouldn't interrupt what screen readers are currently announcing.\n * speak( 'The message you want to send to the ARIA live region' );\n *\n * // For assertive messages that should interrupt what screen readers are currently announcing.\n * speak( 'The message you want to send to the ARIA live region', 'assertive' );\n * ```\n */\nexport function speak( message, ariaLive ) {\n\t/*\n\t * Clear previous messages to allow repeated strings being read out and hide\n\t * the explanatory text from assistive technologies.\n\t */\n\tclear();\n\n\tmessage = filterMessage( message );\n\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\tconst containerAssertive = document.getElementById(\n\t\t'a11y-speak-assertive'\n\t);\n\tconst containerPolite = document.getElementById( 'a11y-speak-polite' );\n\n\tif ( containerAssertive && ariaLive === 'assertive' ) {\n\t\tcontainerAssertive.textContent = message;\n\t} else if ( containerPolite ) {\n\t\tcontainerPolite.textContent = message;\n\t}\n\n\t/*\n\t * Make the explanatory text available to assistive technologies by removing\n\t * the 'hidden' HTML attribute.\n\t */\n\tif ( introText ) {\n\t\tintroText.removeAttribute( 'hidden' );\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAkB;AAClB,4BAA0B;AAoBnB,SAAS,MAAO,SAAS,UAAW;AAK1C,mBAAAA,SAAM;AAEN,gBAAU,sBAAAC,SAAe,OAAQ;AAEjC,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,sBAAsB,aAAa,aAAc;AACrD,uBAAmB,cAAc;AAAA,EAClC,WAAY,iBAAkB;AAC7B,oBAAgB,cAAc;AAAA,EAC/B;AAMA,MAAK,WAAY;AAChB,cAAU,gBAAiB,QAAS;AAAA,EACrC;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAkB;AAClB,4BAA0B;AAoBnB,SAAS,MAAO,SAAS,UAAW;AAK1C,mBAAAA,SAAM;AAEN,gBAAU,sBAAAC,SAAe,OAAQ;AAEjC,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,sBAAsB,aAAa,aAAc;AACrD,uBAAmB,cAAc;AAAA,EAClC,WAAY,iBAAkB;AAC7B,oBAAgB,cAAc;AAAA,EAC/B;AAMA,MAAK,WAAY;AAChB,cAAU,gBAAiB,QAAS;AAAA,EACrC;AACD;",
6
6
  "names": ["clear", "filterMessage"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/a11y/src/index.js
1
2
  import domReady from "@wordpress/dom-ready";
2
3
  import addContainer from "./script/add-container";
3
4
  import addIntroText from "./script/add-intro-text";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport domReady from '@wordpress/dom-ready';\n\n/**\n * Internal dependencies\n */\nimport addContainer from './script/add-container';\nimport addIntroText from './script/add-intro-text';\n\nexport { speak } from './shared/index';\n\n/**\n * Create the live regions.\n */\nexport function setup() {\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\tconst containerAssertive = document.getElementById(\n\t\t'a11y-speak-assertive'\n\t);\n\tconst containerPolite = document.getElementById( 'a11y-speak-polite' );\n\n\tif ( introText === null ) {\n\t\taddIntroText();\n\t}\n\n\tif ( containerAssertive === null ) {\n\t\taddContainer( 'assertive' );\n\t}\n\n\tif ( containerPolite === null ) {\n\t\taddContainer( 'polite' );\n\t}\n}\n\n/**\n * Run setup on domReady.\n */\ndomReady( setup );\n"],
5
- "mappings": "AAGA,OAAO,cAAc;AAKrB,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AAEzB,SAAS,aAAa;AAKf,SAAS,QAAQ;AACvB,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,cAAc,MAAO;AACzB,iBAAa;AAAA,EACd;AAEA,MAAK,uBAAuB,MAAO;AAClC,iBAAc,WAAY;AAAA,EAC3B;AAEA,MAAK,oBAAoB,MAAO;AAC/B,iBAAc,QAAS;AAAA,EACxB;AACD;AAKA,SAAU,KAAM;",
5
+ "mappings": ";AAGA,OAAO,cAAc;AAKrB,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AAEzB,SAAS,aAAa;AAKf,SAAS,QAAQ;AACvB,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,cAAc,MAAO;AACzB,iBAAa;AAAA,EACd;AAEA,MAAK,uBAAuB,MAAO;AAClC,iBAAc,WAAY;AAAA,EAC3B;AAEA,MAAK,oBAAoB,MAAO;AAC/B,iBAAc,QAAS;AAAA,EACxB;AACD;AAKA,SAAU,KAAM;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/a11y/src/module/index.ts
1
2
  import { speak } from "../shared/index";
2
- const setup = () => {
3
+ var setup = () => {
3
4
  };
4
5
  export {
5
6
  setup,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/module/index.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nexport { speak } from '../shared/index';\n\n/**\n * This no-op function is exported to provide compatibility with the `wp-a11y` Script.\n *\n * Filters should inject the relevant HTML on page load instead of requiring setup.\n */\nexport const setup = () => {};\n"],
5
- "mappings": "AAGA,SAAS,aAAa;AAOf,MAAM,QAAQ,MAAM;AAAC;",
5
+ "mappings": ";AAGA,SAAS,aAAa;AAOf,IAAM,QAAQ,MAAM;AAAC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/a11y/src/script/add-container.js
1
2
  function addContainer(ariaLive = "polite") {
2
3
  const container = document.createElement("div");
3
4
  container.id = `a11y-speak-${ariaLive}`;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/script/add-container.js"],
4
4
  "sourcesContent": ["/**\n * Build the live regions markup.\n *\n * @param {'polite'|'assertive'} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'.\n *\n * @return {HTMLDivElement} The ARIA live region HTML element.\n */\nexport default function addContainer( ariaLive = 'polite' ) {\n\tconst container = document.createElement( 'div' );\n\tcontainer.id = `a11y-speak-${ ariaLive }`;\n\tcontainer.className = 'a11y-speak-region';\n\n\tcontainer.setAttribute(\n\t\t'style',\n\t\t'position:absolute;' +\n\t\t\t'margin:-1px;' +\n\t\t\t'padding:0;' +\n\t\t\t'height:1px;' +\n\t\t\t'width:1px;' +\n\t\t\t'overflow:hidden;' +\n\t\t\t'clip-path:inset(50%);' +\n\t\t\t'border:0;' +\n\t\t\t'word-wrap:normal !important;'\n\t);\n\tcontainer.setAttribute( 'aria-live', ariaLive );\n\tcontainer.setAttribute( 'aria-relevant', 'additions text' );\n\tcontainer.setAttribute( 'aria-atomic', 'true' );\n\n\tconst { body } = document;\n\tif ( body ) {\n\t\tbody.appendChild( container );\n\t}\n\n\treturn container;\n}\n"],
5
- "mappings": "AAOe,SAAR,aAA+B,WAAW,UAAW;AAC3D,QAAM,YAAY,SAAS,cAAe,KAAM;AAChD,YAAU,KAAK,cAAe,QAAS;AACvC,YAAU,YAAY;AAEtB,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,aAAa,QAAS;AAC9C,YAAU,aAAc,iBAAiB,gBAAiB;AAC1D,YAAU,aAAc,eAAe,MAAO;AAE9C,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
5
+ "mappings": ";AAOe,SAAR,aAA+B,WAAW,UAAW;AAC3D,QAAM,YAAY,SAAS,cAAe,KAAM;AAChD,YAAU,KAAK,cAAe,QAAS;AACvC,YAAU,YAAY;AAEtB,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,aAAa,QAAS;AAC9C,YAAU,aAAc,iBAAiB,gBAAiB;AAC1D,YAAU,aAAc,eAAe,MAAO;AAE9C,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/a11y/src/script/add-intro-text.ts
1
2
  import { __ } from "@wordpress/i18n";
2
3
  function addIntroText() {
3
4
  const introText = document.createElement("p");
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/script/add-intro-text.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Build the explanatory text to be placed before the aria live regions.\n *\n * This text is initially hidden from assistive technologies by using a `hidden`\n * HTML attribute which is then removed once a message fills the aria-live regions.\n *\n * @return {HTMLParagraphElement} The explanatory text HTML element.\n */\nexport default function addIntroText() {\n\tconst introText = document.createElement( 'p' );\n\n\tintroText.id = 'a11y-speak-intro-text';\n\tintroText.className = 'a11y-speak-intro-text';\n\tintroText.textContent = __( 'Notifications' );\n\n\tintroText.setAttribute(\n\t\t'style',\n\t\t'position:absolute;' +\n\t\t\t'margin:-1px;' +\n\t\t\t'padding:0;' +\n\t\t\t'height:1px;' +\n\t\t\t'width:1px;' +\n\t\t\t'overflow:hidden;' +\n\t\t\t'clip-path:inset(50%);' +\n\t\t\t'border:0;' +\n\t\t\t'word-wrap:normal !important;'\n\t);\n\tintroText.setAttribute( 'hidden', '' );\n\n\tconst { body } = document;\n\tif ( body ) {\n\t\tbody.appendChild( introText );\n\t}\n\n\treturn introText;\n}\n"],
5
- "mappings": "AAGA,SAAS,UAAU;AAUJ,SAAR,eAAgC;AACtC,QAAM,YAAY,SAAS,cAAe,GAAI;AAE9C,YAAU,KAAK;AACf,YAAU,YAAY;AACtB,YAAU,cAAc,GAAI,eAAgB;AAE5C,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,UAAU,EAAG;AAErC,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
5
+ "mappings": ";AAGA,SAAS,UAAU;AAUJ,SAAR,eAAgC;AACtC,QAAM,YAAY,SAAS,cAAe,GAAI;AAE9C,YAAU,KAAK;AACf,YAAU,YAAY;AACtB,YAAU,cAAc,GAAI,eAAgB;AAE5C,YAAU;AAAA,IACT;AAAA,IACA;AAAA,EASD;AACA,YAAU,aAAc,UAAU,EAAG;AAErC,QAAM,EAAE,KAAK,IAAI;AACjB,MAAK,MAAO;AACX,SAAK,YAAa,SAAU;AAAA,EAC7B;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/a11y/src/shared/clear.js
1
2
  function clear() {
2
3
  const regions = document.getElementsByClassName("a11y-speak-region");
3
4
  const introText = document.getElementById("a11y-speak-intro-text");
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/clear.js"],
4
4
  "sourcesContent": ["/**\n * Clears the a11y-speak-region elements and hides the explanatory text.\n */\nexport default function clear() {\n\tconst regions = document.getElementsByClassName( 'a11y-speak-region' );\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\n\tfor ( let i = 0; i < regions.length; i++ ) {\n\t\tregions[ i ].textContent = '';\n\t}\n\n\t// Make sure the explanatory text is hidden from assistive technologies.\n\tif ( introText ) {\n\t\tintroText.setAttribute( 'hidden', 'hidden' );\n\t}\n}\n"],
5
- "mappings": "AAGe,SAAR,QAAyB;AAC/B,QAAM,UAAU,SAAS,uBAAwB,mBAAoB;AACrE,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AAEnE,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,YAAS,CAAE,EAAE,cAAc;AAAA,EAC5B;AAGA,MAAK,WAAY;AAChB,cAAU,aAAc,UAAU,QAAS;AAAA,EAC5C;AACD;",
5
+ "mappings": ";AAGe,SAAR,QAAyB;AAC/B,QAAM,UAAU,SAAS,uBAAwB,mBAAoB;AACrE,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AAEnE,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,YAAS,CAAE,EAAE,cAAc;AAAA,EAC5B;AAGA,MAAK,WAAY;AAChB,cAAU,aAAc,UAAU,QAAS;AAAA,EAC5C;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- let previousMessage = "";
1
+ // packages/a11y/src/shared/filter-message.js
2
+ var previousMessage = "";
2
3
  function filterMessage(message) {
3
4
  message = message.replace(/<[^<>]+>/g, " ");
4
5
  if (previousMessage === message) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/filter-message.js"],
4
4
  "sourcesContent": ["let previousMessage = '';\n\n/**\n * Filter the message to be announced to the screenreader.\n *\n * @param {string} message The message to be announced.\n *\n * @return {string} The filtered message.\n */\nexport default function filterMessage( message ) {\n\t/*\n\t * Strip HTML tags (if any) from the message string. Ideally, messages should\n\t * be simple strings, carefully crafted for specific use with A11ySpeak.\n\t * When re-using already existing strings this will ensure simple HTML to be\n\t * stripped out and replaced with a space. Browsers will collapse multiple\n\t * spaces natively.\n\t */\n\tmessage = message.replace( /<[^<>]+>/g, ' ' );\n\n\t/*\n\t * Safari + VoiceOver don't announce repeated, identical strings. We use\n\t * a `no-break space` to force them to think identical strings are different.\n\t */\n\tif ( previousMessage === message ) {\n\t\tmessage += '\\u00A0';\n\t}\n\n\tpreviousMessage = message;\n\n\treturn message;\n}\n"],
5
- "mappings": "AAAA,IAAI,kBAAkB;AASP,SAAR,cAAgC,SAAU;AAQhD,YAAU,QAAQ,QAAS,aAAa,GAAI;AAM5C,MAAK,oBAAoB,SAAU;AAClC,eAAW;AAAA,EACZ;AAEA,oBAAkB;AAElB,SAAO;AACR;",
5
+ "mappings": ";AAAA,IAAI,kBAAkB;AASP,SAAR,cAAgC,SAAU;AAQhD,YAAU,QAAQ,QAAS,aAAa,GAAI;AAM5C,MAAK,oBAAoB,SAAU;AAClC,eAAW;AAAA,EACZ;AAEA,oBAAkB;AAElB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/a11y/src/shared/index.js
1
2
  import clear from "./clear";
2
3
  import filterMessage from "./filter-message";
3
4
  function speak(message, ariaLive) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/shared/index.js"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport clear from './clear';\nimport filterMessage from './filter-message';\n\n/**\n * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.\n * This module is inspired by the `speak` function in `wp-a11y.js`.\n *\n * @param {string} message The message to be announced by assistive technologies.\n * @param {'polite'|'assertive'} [ariaLive] The politeness level for aria-live; default: 'polite'.\n *\n * @example\n * ```js\n * import { speak } from '@wordpress/a11y';\n *\n * // For polite messages that shouldn't interrupt what screen readers are currently announcing.\n * speak( 'The message you want to send to the ARIA live region' );\n *\n * // For assertive messages that should interrupt what screen readers are currently announcing.\n * speak( 'The message you want to send to the ARIA live region', 'assertive' );\n * ```\n */\nexport function speak( message, ariaLive ) {\n\t/*\n\t * Clear previous messages to allow repeated strings being read out and hide\n\t * the explanatory text from assistive technologies.\n\t */\n\tclear();\n\n\tmessage = filterMessage( message );\n\n\tconst introText = document.getElementById( 'a11y-speak-intro-text' );\n\tconst containerAssertive = document.getElementById(\n\t\t'a11y-speak-assertive'\n\t);\n\tconst containerPolite = document.getElementById( 'a11y-speak-polite' );\n\n\tif ( containerAssertive && ariaLive === 'assertive' ) {\n\t\tcontainerAssertive.textContent = message;\n\t} else if ( containerPolite ) {\n\t\tcontainerPolite.textContent = message;\n\t}\n\n\t/*\n\t * Make the explanatory text available to assistive technologies by removing\n\t * the 'hidden' HTML attribute.\n\t */\n\tif ( introText ) {\n\t\tintroText.removeAttribute( 'hidden' );\n\t}\n}\n"],
5
- "mappings": "AAGA,OAAO,WAAW;AAClB,OAAO,mBAAmB;AAoBnB,SAAS,MAAO,SAAS,UAAW;AAK1C,QAAM;AAEN,YAAU,cAAe,OAAQ;AAEjC,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,sBAAsB,aAAa,aAAc;AACrD,uBAAmB,cAAc;AAAA,EAClC,WAAY,iBAAkB;AAC7B,oBAAgB,cAAc;AAAA,EAC/B;AAMA,MAAK,WAAY;AAChB,cAAU,gBAAiB,QAAS;AAAA,EACrC;AACD;",
5
+ "mappings": ";AAGA,OAAO,WAAW;AAClB,OAAO,mBAAmB;AAoBnB,SAAS,MAAO,SAAS,UAAW;AAK1C,QAAM;AAEN,YAAU,cAAe,OAAQ;AAEjC,QAAM,YAAY,SAAS,eAAgB,uBAAwB;AACnE,QAAM,qBAAqB,SAAS;AAAA,IACnC;AAAA,EACD;AACA,QAAM,kBAAkB,SAAS,eAAgB,mBAAoB;AAErE,MAAK,sBAAsB,aAAa,aAAc;AACrD,uBAAmB,cAAc;AAAA,EAClC,WAAY,iBAAkB;AAC7B,oBAAgB,cAAc;AAAA,EAC/B;AAMA,MAAK,WAAY;AAChB,cAAU,gBAAiB,QAAS;AAAA,EACrC;AACD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/a11y",
3
- "version": "4.33.1",
3
+ "version": "4.34.1-next.2f1c7c01b.0",
4
4
  "description": "Accessibility (a11y) utilities for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -39,11 +39,11 @@
39
39
  "wpScriptModuleExports": "./build-module/module/index.js",
40
40
  "types": "build-types",
41
41
  "dependencies": {
42
- "@wordpress/dom-ready": "^4.33.1",
43
- "@wordpress/i18n": "^6.6.1"
42
+ "@wordpress/dom-ready": "^4.34.1-next.2f1c7c01b.0",
43
+ "@wordpress/i18n": "^6.7.1-next.2f1c7c01b.0"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "5f84bafdec1bed05247c1080c12f6a237951b862"
48
+ "gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
49
49
  }