diff --git a/static/ejs/partials/scripts/ruleOffcanvas.ejs b/static/ejs/partials/scripts/ruleOffcanvas.ejs
index 3779acc2..831e976a 100644
--- a/static/ejs/partials/scripts/ruleOffcanvas.ejs
+++ b/static/ejs/partials/scripts/ruleOffcanvas.ejs
@@ -71,11 +71,7 @@ category summary is clicked %>
document.getElementById('expandedRuleConformance').replaceChildren(
createElementFromString(`
-
+
${
selectedRule.conformance[0] === 'best-practice'
? `
Best practice`
diff --git a/static/ejs/partials/scripts/utils.ejs b/static/ejs/partials/scripts/utils.ejs
index eb51120f..f46402d2 100644
--- a/static/ejs/partials/scripts/utils.ejs
+++ b/static/ejs/partials/scripts/utils.ejs
@@ -9,9 +9,7 @@
const purpleAiHtmlETL = <%- purpleAi.htmlETL %>;
const purpleAiRules = <%- JSON.stringify(purpleAi.rules) %>;
- const htmlTagAndAttributeRegex = new RegExp(
- /((?<=[<])\s*([a-zA-Z][^\s>/]*)\b)|([\w-]+)\s*(?==\s*["']([^"']*)["'])/g,
- );
+ const htmlTagAndAttributeRegex = new RegExp(/([a-zA-Z][^\s/>]*\b)|([\w-]+)\s*=\s*["']([^"']*)["']/g);
const rulesUsingRoles = [
'aria-allowed-attr',
@@ -23,9 +21,8 @@
];
const createLabelForRuleWithRole = html => {
- const htmlTagAndRoleAttributeRegex = new RegExp(
- /(?<=<)\s*([a-zA-Z][^\s>/]*\b)|role="([^"]*)"/g,
- );
+ const htmlTagAndRoleAttributeRegex = new RegExp(/<\s*([a-zA-Z][^\s/>]*\b)|role="([^"]*)"/g);
+
const htmlLabel = html.match(htmlTagAndRoleAttributeRegex).toString().replaceAll(',', '_');
return htmlLabel || '';
diff --git a/static/ejs/report.ejs b/static/ejs/report.ejs
index ffa6a69e..6bf167d3 100644
--- a/static/ejs/report.ejs
+++ b/static/ejs/report.ejs
@@ -38,7 +38,9 @@
document.querySelectorAll('[data-bs-toggle="tooltip"]'),
);
tooltipTriggerList.map((tooltipTriggerEl) => {
- return new bootstrap.Tooltip(tooltipTriggerEl);
+ const tooltip = new bootstrap.Tooltip(tooltipTriggerEl);
+ tooltipTriggerEl.addEventListener('mouseleave', () => tooltip.hide());
+ return tooltip;
});
};
document.addEventListener('DOMContentLoaded', initTooltips);
diff --git a/static/ejs/summary.ejs b/static/ejs/summary.ejs
index 879fa58d..b63906bd 100644
--- a/static/ejs/summary.ejs
+++ b/static/ejs/summary.ejs
@@ -40,7 +40,9 @@
document.querySelectorAll('[data-bs-toggle="tooltip"]'),
);
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
- return new bootstrap.Tooltip(tooltipTriggerEl);
+ const tooltip = new bootstrap.Tooltip(tooltipTriggerEl);
+ tooltipTriggerEl.addEventListener('mouseleave', () => tooltip.hide());
+ return tooltip;
});
});