diff --git a/common/script/aria.js b/common/script/aria.js
index 70a339124..b083334ab 100644
--- a/common/script/aria.js
+++ b/common/script/aria.js
@@ -132,6 +132,25 @@ const buildStatesProperties = function (item) {
};
};
+/**
+ * Parse a role-namerequired cell while excluding caveat span text.
+ * @param {HTMLTableCellElement} cell
+ * @returns {{ primary: string, caveat: string, combined: string }}
+ */
+const parseNameRequiredCell = (cell) => {
+ const caveatNode = cell?.querySelector("span.role-namerequired-caveat");
+ const caveat = (caveatNode?.innerText || "").trim();
+ const clone = cell?.cloneNode(true);
+ clone?.querySelectorAll("span.role-namerequired-caveat").forEach((node) => node.remove());
+ const primary = (clone?.innerText || "").trim();
+
+ return {
+ primary,
+ caveat,
+ combined: `${primary} ${caveat}`.trim(),
+ };
+};
+
/**
*
* @param {String} indexTest - string to decide if this index needs it
@@ -151,7 +170,8 @@ const renderIndexEntry = (indexTest, rdef) => {
}
if (!isAbstract && roleFromNode) {
const content = rdef.innerText;
- const isRequired = roleFromNode.closest("table").querySelector(".role-namerequired")?.innerText === "True";
+ const nameRequiredCell = roleFromNode.closest("table").querySelector("td.role-namerequired");
+ const isRequired = parseNameRequiredCell(nameRequiredCell).primary === "True";
if (roleFromNode.textContent.indexOf(indexTest) !== -1) return `
${content}${isRequired ? " (name required)" : ""}`; // TODO: `textContent.indexOf` feels brittle; right now it's either the exact string or proper list markup with LI with exact string
}
};
@@ -287,7 +307,7 @@ const pruneUnusedRows = () => {
".role-abstract, .role-parent, .role-base, .role-related, .role-scope, .role-mustcontain, .role-required-properties, .role-properties, .role-namefrom, .role-namerequired, .role-namerequired-inherited, .role-childpresentational, .role-presentational-inherited, .state-related, .property-related,.role-inherited, .role-children, .property-descendants, .state-descendants, .implicit-values",
)
.forEach(function (item) {
- var content = item.innerText;
+ var content = item.classList.contains("role-namerequired") ? parseNameRequiredCell(item).primary : item.innerText;
if (content.length === 1 || content.length === 0) {
// there is no item - remove the row
item.parentNode.parentNode.removeChild(item.parentNode);
diff --git a/common/script/ariaChild.js b/common/script/ariaChild.js
index aae9b7bb3..84a2e2b45 100644
--- a/common/script/ariaChild.js
+++ b/common/script/ariaChild.js
@@ -504,6 +504,24 @@ function ariaAttributeReferences() {
updateReferences(document);
+ var parseNameRequiredCell = function (cell) {
+ var caveatNode = cell && cell.querySelector("span.role-namerequired-caveat");
+ var caveat = ((caveatNode ? caveatNode.innerText : "") || "").trim();
+ var clone = cell && cell.cloneNode(true);
+ if (clone) {
+ Array.prototype.slice.call(clone.querySelectorAll("span.role-namerequired-caveat")).forEach(function (node) {
+ node.remove();
+ });
+ }
+ var primary = ((clone ? clone.innerText : "") || "").trim();
+
+ return {
+ primary: primary,
+ caveat: caveat,
+ combined: (primary + " " + caveat).trim(),
+ };
+ };
+
// prune out unused rows throughout the document
Array.prototype.slice
@@ -513,7 +531,9 @@ function ariaAttributeReferences() {
)
)
.forEach(function (item) {
- var content = item.innerText;
+ var content = item.classList.contains("role-namerequired")
+ ? parseNameRequiredCell(item).primary
+ : item.innerText;
if (content.length === 1 || content.length === 0) {
// there is no item - remove the row
item.parentNode.parentNode.removeChild(item.parentNode);
diff --git a/index.html b/index.html
index d3fcb73dc..4ec5b86f3 100644
--- a/index.html
+++ b/index.html
@@ -5542,7 +5542,7 @@ Definition of Roles
| Accessible Name Required: |
- True |
+ True (unless used with combobox) |
| Inherits Name Required: |