@govtechsg/oobee 0.10.93 → 0.10.95

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.
Files changed (71) hide show
  1. package/AGENTS.md +20 -0
  2. package/dist/cli.js +3 -2
  3. package/dist/combine.js +10 -3
  4. package/dist/constants/common.js +131 -52
  5. package/dist/crawlers/commonCrawlerFunc.js +11 -2
  6. package/dist/crawlers/crawlDomain.js +4 -6
  7. package/dist/crawlers/crawlSitemap.js +14 -2
  8. package/dist/crawlers/custom/utils.js +22 -9
  9. package/dist/crawlers/guards/urlGuard.js +19 -1
  10. package/dist/generateHtmlReport.js +12 -1
  11. package/dist/logs.js +6 -0
  12. package/dist/mergeAxeResults/jsonArtifacts.js +6 -1
  13. package/dist/mergeAxeResults.js +41 -15
  14. package/dist/static/ejs/partials/components/allIssues/CategoryBadges.ejs +3 -0
  15. package/dist/static/ejs/partials/components/allIssues/IssuesTable.ejs +3 -3
  16. package/dist/static/ejs/partials/components/header/aboutScanModal/AboutScanModal.ejs +1 -1
  17. package/dist/static/ejs/partials/components/header/aboutScanModal/ScanConfiguration.ejs +3 -3
  18. package/dist/static/ejs/partials/components/header/aboutScanModal/ScanDetails.ejs +34 -27
  19. package/dist/static/ejs/partials/components/ruleModal/ruleOffcanvas.ejs +1 -0
  20. package/dist/static/ejs/partials/components/scannedPagesSegmentedTabs.ejs +7 -0
  21. package/dist/static/ejs/partials/components/wcagCoverageDetails.ejs +5 -5
  22. package/dist/static/ejs/partials/scripts/header/aboutScanModal/AboutScanModal.ejs +3 -3
  23. package/dist/static/ejs/partials/scripts/prioritiseIssues/PrioritiseIssues.ejs +21 -19
  24. package/dist/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +39 -8
  25. package/dist/static/ejs/partials/scripts/scannedPagesSegmentedTabs.ejs +11 -5
  26. package/dist/static/ejs/partials/scripts/screenshotLightbox.ejs +49 -31
  27. package/dist/static/ejs/partials/styles/header/SiteInfo.ejs +1 -1
  28. package/dist/static/ejs/partials/styles/header/aboutScanModal/ScanDetails.ejs +36 -16
  29. package/dist/static/ejs/partials/styles/prioritiseIssues/PrioritiseIssues.ejs +22 -1
  30. package/dist/static/ejs/partials/styles/styles.ejs +1 -1
  31. package/dist/static/ejs/partials/styles/wcagCompliance/WcagGaugeBar.ejs +6 -0
  32. package/dist/static/ejs/partials/styles/wcagCompliance.ejs +5 -4
  33. package/dist/static/ejs/partials/styles/wcagCoverageDetails.ejs +6 -1
  34. package/dist/utils.js +7 -0
  35. package/oobee-client-scanner.js +2 -2
  36. package/package.json +1 -1
  37. package/src/cli.ts +3 -2
  38. package/src/combine.ts +10 -2
  39. package/src/constants/common.ts +125 -36
  40. package/src/crawlers/commonCrawlerFunc.ts +11 -2
  41. package/src/crawlers/crawlDomain.ts +4 -5
  42. package/src/crawlers/crawlSitemap.ts +19 -2
  43. package/src/crawlers/custom/utils.ts +26 -13
  44. package/src/crawlers/guards/urlGuard.ts +18 -1
  45. package/src/generateHtmlReport.ts +13 -1
  46. package/src/logs.ts +6 -0
  47. package/src/mergeAxeResults/jsonArtifacts.ts +6 -1
  48. package/src/mergeAxeResults.ts +41 -15
  49. package/src/static/ejs/partials/components/allIssues/CategoryBadges.ejs +3 -0
  50. package/src/static/ejs/partials/components/allIssues/IssuesTable.ejs +3 -3
  51. package/src/static/ejs/partials/components/header/aboutScanModal/AboutScanModal.ejs +1 -1
  52. package/src/static/ejs/partials/components/header/aboutScanModal/ScanConfiguration.ejs +3 -3
  53. package/src/static/ejs/partials/components/header/aboutScanModal/ScanDetails.ejs +34 -27
  54. package/src/static/ejs/partials/components/ruleModal/ruleOffcanvas.ejs +1 -0
  55. package/src/static/ejs/partials/components/scannedPagesSegmentedTabs.ejs +7 -0
  56. package/src/static/ejs/partials/components/wcagCoverageDetails.ejs +5 -5
  57. package/src/static/ejs/partials/scripts/header/aboutScanModal/AboutScanModal.ejs +3 -3
  58. package/src/static/ejs/partials/scripts/prioritiseIssues/PrioritiseIssues.ejs +21 -19
  59. package/src/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +39 -8
  60. package/src/static/ejs/partials/scripts/scannedPagesSegmentedTabs.ejs +11 -5
  61. package/src/static/ejs/partials/scripts/screenshotLightbox.ejs +49 -31
  62. package/src/static/ejs/partials/styles/header/SiteInfo.ejs +1 -1
  63. package/src/static/ejs/partials/styles/header/aboutScanModal/ScanDetails.ejs +36 -16
  64. package/src/static/ejs/partials/styles/prioritiseIssues/PrioritiseIssues.ejs +22 -1
  65. package/src/static/ejs/partials/styles/styles.ejs +1 -1
  66. package/src/static/ejs/partials/styles/wcagCompliance/WcagGaugeBar.ejs +6 -0
  67. package/src/static/ejs/partials/styles/wcagCompliance.ejs +5 -4
  68. package/src/static/ejs/partials/styles/wcagCoverageDetails.ejs +6 -1
  69. package/src/utils.ts +6 -0
  70. package/testStaticJSScanner.html +1 -1
  71. /package/{7339fae5-e8ed-4b50-af13-317847620dbf.txt → fb5db217-5ab7-4120-b33b-71fa69b454d0.txt} +0 -0
package/dist/logs.js CHANGED
@@ -35,6 +35,10 @@ else {
35
35
  export const errorsTxtPath = path.join(basePath, `${uuid}.txt`);
36
36
  const consoleLogger = createLogger({
37
37
  silent: !(process.env.RUNNING_FROM_PH_GUI || process.env.OOBEE_VERBOSE),
38
+ // exitOnError: false — Winston logs uncaught exceptions but does not call process.exit().
39
+ // Process lifecycle is controlled by psTreeHandler in combine.ts, which suppresses known
40
+ // benign errors (e.g. Playwright post-close connection errors) and rethrows real ones.
41
+ exitOnError: false,
38
42
  format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), logFormat),
39
43
  transports: [
40
44
  new transports.Console({ level: 'info' }),
@@ -49,6 +53,8 @@ const consoleLogger = createLogger({
49
53
  // Also used in common functions to not link internal information
50
54
  // if running from mass scanner, log out errors in console
51
55
  const silentLogger = createLogger({
56
+ // exitOnError: false — see consoleLogger comment above.
57
+ exitOnError: false,
52
58
  format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), logFormat),
53
59
  transports: [
54
60
  new transports.File({
@@ -227,7 +227,12 @@ const writeJsonFileAndCompressedJsonFile = async (data, storagePath, filename, i
227
227
  const writeJsonAndBase64Files = async (allIssues, storagePath, itemsStore) => {
228
228
  const { items, ...rest } = allIssues;
229
229
  const { jsonFilePath: scanDataJsonFilePath, base64FilePath: scanDataBase64FilePath } = await writeJsonFileAndCompressedJsonFile(rest, storagePath, 'scanData');
230
- const { jsonFilePath: scanItemsJsonFilePath, base64FilePath: scanItemsBase64FilePath } = await writeJsonFileAndCompressedJsonFile({ oobeeAppVersion: allIssues.oobeeAppVersion, ...items }, storagePath, 'scanItems', itemsStore);
230
+ // Disk space: passed items excluded from scanItems.json to reduce disk usage.
231
+ // Passed counts are still in scanData.json and the embedded report payload (scanItems-light).
232
+ // To revert, remove the destructure line and restore the original argument:
233
+ // { oobeeAppVersion: allIssues.oobeeAppVersion, ...items }
234
+ const { passed: _passedItems, ...itemsWithoutPassed } = items;
235
+ const { jsonFilePath: scanItemsJsonFilePath, base64FilePath: scanItemsBase64FilePath } = await writeJsonFileAndCompressedJsonFile({ oobeeAppVersion: allIssues.oobeeAppVersion, ...itemsWithoutPassed }, storagePath, 'scanItems', itemsStore);
231
236
  ['mustFix', 'goodToFix', 'needsReview', 'passed'].forEach(category => {
232
237
  if (items[category].rules && Array.isArray(items[category].rules)) {
233
238
  items[category].rules.forEach(rule => {
@@ -256,6 +256,16 @@ const cleanUpJsonFiles = async (filesToDelete) => {
256
256
  });
257
257
  };
258
258
  const writeSummaryPdf = async (storagePath, pagesScanned, filename = 'summary', browser, _userDataDirectory) => {
259
+ // Flush stale browser temp files before launching PDF browser (Docker only,
260
+ // where TMPDIR is a per-scan subdirectory we control).
261
+ if (process.env.TMPDIR && fs.existsSync('/.dockerenv')) {
262
+ try {
263
+ fs.emptyDirSync(process.env.TMPDIR);
264
+ }
265
+ catch {
266
+ // Best-effort; locked files from prior browser sessions are non-fatal.
267
+ }
268
+ }
259
269
  const renderPdfWithBrowser = async (browserToUse) => {
260
270
  let browserInstance;
261
271
  let context;
@@ -390,14 +400,21 @@ const pushResults = async (pageResults, allIssues, isCustomFlow, itemsStore) =>
390
400
  metadata,
391
401
  itemsCount: items.length,
392
402
  };
393
- await itemsStore.appendPageItems(category, rule, {
394
- url,
395
- pageTitle,
396
- items,
397
- pageIndex,
398
- pageImagePath,
399
- metadata,
400
- });
403
+ // Disk space: skip storing passed items in itemsStore.
404
+ // To revert, remove the `if` guard and use the original call directly:
405
+ // await itemsStore.appendPageItems(category, rule, {
406
+ // url, pageTitle, items, pageIndex, pageImagePath, metadata,
407
+ // });
408
+ if (category !== 'passed') {
409
+ await itemsStore.appendPageItems(category, rule, {
410
+ url,
411
+ pageTitle,
412
+ items,
413
+ pageIndex,
414
+ pageImagePath,
415
+ metadata,
416
+ });
417
+ }
401
418
  }
402
419
  else if (!(url in currRuleFromAllIssues.pagesAffected)) {
403
420
  currRuleFromAllIssues.pagesAffected[url] = {
@@ -405,12 +422,19 @@ const pushResults = async (pageResults, allIssues, isCustomFlow, itemsStore) =>
405
422
  itemsCount: items.length,
406
423
  ...(filePath && { filePath }),
407
424
  };
408
- await itemsStore.appendPageItems(category, rule, {
409
- url,
410
- pageTitle,
411
- items,
412
- ...(filePath && { filePath }),
413
- });
425
+ // Disk space: skip storing passed items in itemsStore.
426
+ // To revert, remove the `if` guard and use the original call directly:
427
+ // await itemsStore.appendPageItems(category, rule, {
428
+ // url, pageTitle, items, ...(filePath && { filePath }),
429
+ // });
430
+ if (category !== 'passed') {
431
+ await itemsStore.appendPageItems(category, rule, {
432
+ url,
433
+ pageTitle,
434
+ items,
435
+ ...(filePath && { filePath }),
436
+ });
437
+ }
414
438
  }
415
439
  }
416
440
  }
@@ -708,7 +732,9 @@ generateJsonFiles = false, preferredBrowser) => {
708
732
  }
709
733
  populateScanPagesDetail(allIssues);
710
734
  // Build htmlGroups in a second pass from disk-backed items
711
- for (const category of ['mustFix', 'goodToFix', 'needsReview', 'passed']) {
735
+ // Disk space: 'passed' removed from this loop (no items stored in itemsStore for passed).
736
+ // To revert, restore: ['mustFix', 'goodToFix', 'needsReview', 'passed']
737
+ for (const category of ['mustFix', 'goodToFix', 'needsReview']) {
712
738
  for (const rule of allIssues.items[category].rules) {
713
739
  for await (const entry of itemsStore.readRuleItems(category, rule.rule)) {
714
740
  buildHtmlGroups(rule, entry.items, entry.url);
@@ -7,6 +7,7 @@
7
7
  <button
8
8
  type="button"
9
9
  class="category-tooltip-icon"
10
+ aria-label="About Must Fix category"
10
11
  aria-describedby="mustFixTooltip"
11
12
  >
12
13
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14"
@@ -34,6 +35,7 @@
34
35
  <button
35
36
  type="button"
36
37
  class="category-tooltip-icon"
38
+ aria-label="About Good to Fix category"
37
39
  aria-describedby="goodToFixTooltip"
38
40
  >
39
41
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14"
@@ -61,6 +63,7 @@
61
63
  <button
62
64
  type="button"
63
65
  class="category-tooltip-icon"
66
+ aria-label="About Manual Test category"
64
67
  aria-describedby="manualTestTooltip"
65
68
  >
66
69
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14"
@@ -2,21 +2,21 @@
2
2
  <table class="issues-table" id="issuesTable">
3
3
  <thead>
4
4
  <tr>
5
- <th class="sortable" role="button" tabindex="0" aria-sort="none" style="width: 15%;">
5
+ <th class="sortable" tabindex="0" aria-sort="none" style="width: 15%;">
6
6
  <span>Severity</span>
7
7
  <svg class="sort-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">
8
8
  <path d="M7 9L12 4L17 9H7Z" fill="currentColor" opacity="1" />
9
9
  <path d="M7 15L12 20L17 15H7Z" fill="currentColor" opacity="0.3" />
10
10
  </svg>
11
11
  </th>
12
- <th class="sortable" role="button" tabindex="0" aria-sort="none">
12
+ <th class="sortable" tabindex="0" aria-sort="none">
13
13
  <span>Issue Name</span>
14
14
  <svg class="sort-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">
15
15
  <path d="M7 9L12 4L17 9H7Z" fill="currentColor" opacity="0.3" />
16
16
  <path d="M7 15L12 20L17 15H7Z" fill="currentColor" opacity="1" />
17
17
  </svg>
18
18
  </th>
19
- <th class="sortable" role="button" tabindex="0" aria-sort="descending" style="width: 15%;">
19
+ <th class="sortable" tabindex="0" aria-sort="descending" style="width: 15%;">
20
20
  <span>Occurrence</span>
21
21
  <svg class="sort-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">
22
22
  <path d="M7 9L12 4L17 9H7Z" fill="currentColor" opacity="0.3" />
@@ -1,4 +1,4 @@
1
- <div id="aboutScanModal" class="modal fade" tabindex="-1" aria-labelledby="aboutScanModalLabel" aria-hidden="true">
1
+ <div id="aboutScanModal" class="modal fade" tabindex="-1" aria-label="About this scan" aria-hidden="true">
2
2
  <div class="modal-dialog modal-dialog-centered">
3
3
  <div class="modal-content">
4
4
  <div class="modal-header">
@@ -5,17 +5,17 @@
5
5
  </h2>
6
6
  <%- include('../../scannedPagesSegmentedTabs') %>
7
7
  <div class="seg-panels">
8
- <div id="pages-scanned" role="tabpanel">
8
+ <div id="pages-scanned" role="tabpanel" aria-labelledby="seg-scanned">
9
9
  <ul id="pagesScannedList" class="unbulleted-list">
10
10
  <!-- dynamically populated -->
11
11
  </ul>
12
12
  </div>
13
- <div id="pages-not-scanned" role="tabpanel" hidden>
13
+ <div id="pages-not-scanned" role="tabpanel" aria-labelledby="seg-not-scanned" hidden>
14
14
  <ul id="pagesNotScannedList" class="unbulleted-list">
15
15
  <!-- dynamically populated -->
16
16
  </ul>
17
17
  </div>
18
- <div id="pages-unsupported" role="tabpanel" hidden>
18
+ <div id="pages-unsupported" role="tabpanel" aria-labelledby="seg-unsupported" hidden>
19
19
  <ul id="unsupportedDocsList" class="unbulleted-list">
20
20
  <!-- dynamically populated -->
21
21
  </ul>
@@ -1,5 +1,5 @@
1
1
  <aside id="scan-about" class="about-scan-details-left">
2
- <h1>About this scan</h1>
2
+ <h1 id="aboutScanModalLabel">About this scan</h1>
3
3
  <ul>
4
4
  <li>
5
5
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -33,7 +33,9 @@
33
33
  </span>
34
34
  </li>
35
35
 
36
- <hr class="about-scan-divider" />
36
+ <li class="about-scan-divider-item" aria-hidden="true">
37
+ <hr class="about-scan-divider" />
38
+ </li>
37
39
 
38
40
  <% if (viewport !== null) { %>
39
41
  <li>
@@ -64,7 +66,7 @@
64
66
  type="button"
65
67
  class="js-view-btn about-scan-toggle"
66
68
  aria-controls="view-crawl"
67
- aria-selected="true"
69
+ aria-expanded="true"
68
70
  >
69
71
  <div class="d-flex">
70
72
  <div class="about-scan-link-row">
@@ -82,30 +84,33 @@
82
84
  <path d="M13.2346 8.78333C13.2668 8.53333 13.2828 8.275 13.2828 8C13.2828 7.73333 13.2668 7.46667 13.2266 7.21667L14.857 5.9C15.0016 5.78333 15.0418 5.55833 14.9534 5.39167L13.4113 2.625C13.315 2.44167 13.1142 2.38333 12.9375 2.44167L11.0179 3.24167C10.6163 2.925 10.1906 2.65833 9.71675 2.45833L9.42761 0.341667C9.39548 0.141667 9.23485 0 9.04209 0H5.95791C5.76515 0 5.61255 0.141667 5.58042 0.341667L5.29128 2.45833C4.81741 2.65833 4.3837 2.93333 3.99015 3.24167L2.07057 2.44167C1.89387 2.375 1.69308 2.44167 1.5967 2.625L0.0626475 5.39167C-0.0337329 5.56667 -0.00160615 5.78333 0.159028 5.9L1.78946 7.21667C1.7493 7.46667 1.71718 7.74167 1.71718 8C1.71718 8.25833 1.73324 8.53333 1.7734 8.78333L0.142964 10.1C-0.00160614 10.2167 -0.0417645 10.4417 0.0465841 10.6083L1.58867 13.375C1.68505 13.5583 1.88584 13.6167 2.06254 13.5583L3.98212 12.7583C4.3837 13.075 4.80938 13.3417 5.28325 13.5417L5.57239 15.6583C5.61255 15.8583 5.76515 16 5.95791 16H9.04209C9.23485 16 9.39548 15.8583 9.41958 15.6583L9.70872 13.5417C10.1826 13.3417 10.6163 13.075 11.0099 12.7583L12.9294 13.5583C13.1061 13.625 13.3069 13.5583 13.4033 13.375L14.9454 10.6083C15.0418 10.425 15.0016 10.2167 14.849 10.1L13.2346 8.78333ZM7.5 11C5.90972 11 4.60859 9.65 4.60859 8C4.60859 6.35 5.90972 5 7.5 5C9.09028 5 10.3914 6.35 10.3914 8C10.3914 9.65 9.09028 11 7.5 11Z" fill="#686868"/>
83
85
  </svg>
84
86
 
85
- <div>
86
- Advanced scan options enabled
87
+ <div class="advanced-group-content">
88
+ <div>
89
+ Advanced scan options enabled
90
+ </div>
91
+
92
+ <ul class="advanced-sublist">
93
+ <% if (advancedScanOptionsSummaryItems.showIncludeScreenshots) { %>
94
+ <li class="advanced-sublist-li">Include screenshots</li>
95
+ <% } %>
96
+ <% if (advancedScanOptionsSummaryItems.showAllowSubdomains) { %>
97
+ <li class="advanced-sublist-li">Allow subdomains for scans</li>
98
+ <% } %>
99
+ <% if (advancedScanOptionsSummaryItems.showEnableCustomChecks) { %>
100
+ <li class="advanced-sublist-li">Enable custom checks</li>
101
+ <% } %>
102
+ <% if (advancedScanOptionsSummaryItems.showEnableWcagAaa) { %>
103
+ <li class="advanced-sublist-li">Enable WCAG AAA checks</li>
104
+ <% } %>
105
+ <% if (advancedScanOptionsSummaryItems.showSlowScanMode) { %>
106
+ <li class="advanced-sublist-li">Slow scan mode</li>
107
+ <% } %>
108
+ <% if (advancedScanOptionsSummaryItems.showAdhereRobots) { %>
109
+ <li class="advanced-sublist-li">Adhere to robots.txt</li>
110
+ <% } %>
111
+ </ul>
87
112
  </div>
88
113
  </li>
89
- <ul class="advanced-sublist">
90
- <% if (advancedScanOptionsSummaryItems.showIncludeScreenshots) { %>
91
- <li class="advanced-sublist-li">Include screenshots</li>
92
- <% } %>
93
- <% if (advancedScanOptionsSummaryItems.showAllowSubdomains) { %>
94
- <li class="advanced-sublist-li">Allow subdomains for scans</li>
95
- <% } %>
96
- <% if (advancedScanOptionsSummaryItems.showEnableCustomChecks) { %>
97
- <li class="advanced-sublist-li">Enable custom checks</li>
98
- <% } %>
99
- <% if (advancedScanOptionsSummaryItems.showEnableWcagAaa) { %>
100
- <li class="advanced-sublist-li">Enable WCAG AAA checks</li>
101
- <% } %>
102
- <% if (advancedScanOptionsSummaryItems.showSlowScanMode) { %>
103
- <li class="advanced-sublist-li">Slow scan mode</li>
104
- <% } %>
105
- <% if (advancedScanOptionsSummaryItems.showAdhereRobots) { %>
106
- <li class="advanced-sublist-li">Adhere to robots.txt</li>
107
- <% } %>
108
- </ul>
109
114
 
110
115
  <li>
111
116
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -115,7 +120,7 @@
115
120
  type="button"
116
121
  class="js-view-btn about-scan-toggle"
117
122
  aria-controls="view-wcag"
118
- aria-selected="false"
123
+ aria-expanded="false"
119
124
  >
120
125
  <span class="wcag-criteria-label">
121
126
  WCAG Automated Testing
@@ -131,7 +136,9 @@
131
136
  </button>
132
137
  </li>
133
138
 
134
- <hr class="about-scan-divider" />
139
+ <li class="about-scan-divider-item" aria-hidden="true">
140
+ <hr class="about-scan-divider" />
141
+ </li>
135
142
 
136
143
  <li>
137
144
  <span id="oobeeAppVersion" class="oobee-version-text">N/A</span>
@@ -129,6 +129,7 @@
129
129
  <div
130
130
  id="pagesAccordionContent"
131
131
  class="accordion-collapse collapse"
132
+ role="region"
132
133
  aria-labelledby="pagesAccordionHeader"
133
134
  data-bs-parent="#pagesAccordion"
134
135
  >
@@ -1,9 +1,12 @@
1
1
  <div class="segmented-tabs" role="tablist" aria-label="Crawl views">
2
2
  <button
3
3
  type="button"
4
+ id="seg-scanned"
4
5
  class="seg-pill"
6
+ role="tab"
5
7
  aria-controls="pages-scanned"
6
8
  aria-selected="true"
9
+ tabindex="0"
7
10
  data-tab-target="#pages-scanned"
8
11
  >
9
12
  <span id="totalPagesScannedLabel">
@@ -18,8 +21,10 @@
18
21
  type="button"
19
22
  id="seg-not-scanned"
20
23
  class="seg-pill"
24
+ role="tab"
21
25
  aria-controls="pages-not-scanned"
22
26
  aria-selected="false"
27
+ tabindex="-1"
23
28
  data-tab-target="#pages-not-scanned"
24
29
  >
25
30
  <span id="totalPagesNotScannedLabel">
@@ -34,8 +39,10 @@
34
39
  type="button"
35
40
  id="seg-unsupported"
36
41
  class="seg-pill"
42
+ role="tab"
37
43
  aria-controls="pages-unsupported"
38
44
  aria-selected="false"
45
+ tabindex="-1"
39
46
  data-tab-target="#pages-unsupported"
40
47
  >
41
48
  <span id="totalUnsupportedDocsLabel">
@@ -1,15 +1,15 @@
1
1
  <div id="wcagCoverage" class="my-3">
2
- <h5 class="fw-semibold mb-2">
3
- <span id="wcagAALabelCount">20</span> (A &amp; AA) WCAG Success Criteria
4
- </h5>
2
+ <h3 class="wcag-criteria-heading fw-semibold mb-2">
3
+ <span id="wcagAALabelCount">20</span> (A & AA) WCAG Success Criteria
4
+ </h3>
5
5
  <div class="wcag-box">
6
6
  <ul id="wcagLinksListAA" class="wcag-grid list-unstyled m-0">
7
7
  <!-- dynamically populated -->
8
8
  </ul>
9
9
  </div>
10
- <h5 class="fw-semibold mt-4 mb-2">
10
+ <h3 class="wcag-criteria-heading fw-semibold mt-4 mb-2">
11
11
  <span id="wcagAAALabelCount">6</span> (AAA) WCAG Success Criteria
12
- </h5>
12
+ </h3>
13
13
  <div class="wcag-box">
14
14
  <ul id="wcagLinksListAAA" class="wcag-grid list-unstyled m-0">
15
15
  <!-- dynamically populated -->
@@ -6,8 +6,8 @@
6
6
  function showPane(targetId) {
7
7
  // hide all panes
8
8
  panes.forEach(p => p.hidden = true);
9
- // deselect all buttons
10
- btns.forEach(b => b.setAttribute('aria-selected', 'false'));
9
+ // collapse all buttons
10
+ btns.forEach(b => b.setAttribute('aria-expanded', 'false'));
11
11
 
12
12
  // show the requested pane
13
13
  const pane = document.getElementById(targetId);
@@ -16,7 +16,7 @@
16
16
 
17
17
  // mark the controlling button active
18
18
  const btn = btns.find(b => b.getAttribute('aria-controls') === targetId);
19
- if (btn) btn.setAttribute('aria-selected', 'true');
19
+ if (btn) btn.setAttribute('aria-expanded', 'true');
20
20
 
21
21
  // move focus to the pane heading for screen readers/keyboard users
22
22
  const h = pane.querySelector('h4, h3, h2, [role="heading"]');
@@ -84,11 +84,13 @@
84
84
  : '';
85
85
 
86
86
  return `
87
- <li class="priority-issue-item d-flex g-one" data-rule-id="${issue.ruleId}" role="button" tabindex="0">
88
- <div class="d-flex justify-content-between align-items-center w-90">
89
- <div class="priority-issue-title">${issue.description}</div>
90
- ${disabilityBadges}
91
- </div>
87
+ <li class="priority-issue-item" data-rule-id="${issue.ruleId}">
88
+ <button type="button" class="priority-issue-action d-flex g-one" aria-pressed="false">
89
+ <div class="d-flex justify-content-between align-items-center w-90">
90
+ <div class="priority-issue-title">${issue.description}</div>
91
+ ${disabilityBadges}
92
+ </div>
93
+ </button>
92
94
  </li>
93
95
  `;
94
96
  })
@@ -122,7 +124,7 @@
122
124
  data-bs-parent="#prioritiseIssuesAccordion"
123
125
  >
124
126
  <div class="accordion-body">
125
- <ul class="priority-issues-list">
127
+ <ul class="priority-issues-list" aria-label="Priority issues">
126
128
  ${issuesListHTML}
127
129
  </ul>
128
130
  </div>
@@ -135,19 +137,25 @@
135
137
  accordionContainer.innerHTML = accordionHTML;
136
138
 
137
139
  document.querySelectorAll('.priority-issue-item').forEach(item => {
140
+ const actionButton = item.querySelector('.priority-issue-action');
141
+ if (!actionButton) return;
142
+
138
143
  const selectIssue = function () {
139
144
  const ruleId = item.getAttribute('data-rule-id');
140
145
 
141
146
  document.querySelectorAll('.priority-issue-item').forEach(el => {
142
147
  el.classList.remove('active');
143
- el.setAttribute('aria-selected', 'false');
148
+ const button = el.querySelector('.priority-issue-action');
149
+ if (button) {
150
+ button.setAttribute('aria-pressed', 'false');
151
+ }
144
152
  });
145
153
  document.querySelectorAll('.priority-issue-title').forEach(el => {
146
154
  el.classList.remove('active');
147
155
  });
148
156
 
149
157
  item.classList.add('active');
150
- item.setAttribute('aria-selected', 'true');
158
+ actionButton.setAttribute('aria-pressed', 'true');
151
159
  const title = item.querySelector('.priority-issue-title');
152
160
  if (title) {
153
161
  title.classList.add('active');
@@ -167,16 +175,7 @@
167
175
  }
168
176
  };
169
177
 
170
- // Click handler
171
- item.addEventListener('click', selectIssue);
172
-
173
- // Keyboard handler
174
- item.addEventListener('keydown', function (event) {
175
- if (event.key === 'Enter' || event.key === ' ') {
176
- event.preventDefault();
177
- selectIssue();
178
- }
179
- });
178
+ actionButton.addEventListener('click', selectIssue);
180
179
  });
181
180
 
182
181
  // Automatically open first accordion and select first issue
@@ -197,7 +196,10 @@
197
196
  const firstIssueItem = document.querySelector('.priority-issue-item');
198
197
  if (firstIssueItem) {
199
198
  firstIssueItem.classList.add('active');
200
- firstIssueItem.setAttribute('aria-selected', 'true');
199
+ const firstIssueButton = firstIssueItem.querySelector('.priority-issue-action');
200
+ if (firstIssueButton) {
201
+ firstIssueButton.setAttribute('aria-pressed', 'true');
202
+ }
201
203
  const firstIssueTitle = firstIssueItem.querySelector('.priority-issue-title');
202
204
  if (firstIssueTitle) {
203
205
  firstIssueTitle.classList.add('active');
@@ -451,7 +451,7 @@
451
451
  <div id="${accordionId}-content" class="accordion-collapse collapse" aria-labelledby="${accordionId}-title">
452
452
  <div class="accordion-body p-3">
453
453
  ${isCustomFlow
454
- ? createCustomFlowContent(page)
454
+ ? createCustomFlowContent(page, ruleInCategory)
455
455
  :
456
456
  `<div class="d-flex align-items-center gap-1 accordion-link" style=" word-wrap: break-word; word-break: break-word;">
457
457
  <a href="${page.url}" target="_blank">${page.url}
@@ -486,16 +486,46 @@
486
486
  return accordion;
487
487
  }
488
488
 
489
- function createCustomFlowContent(page) {
489
+ function getCustomFlowPageScreenshot(page, ruleInCategory) {
490
+ if (page && page.pageImagePath) return page.pageImagePath;
491
+
492
+ // Use same source-of-truth as scanAboutModal.
493
+ const scannedPages =
494
+ typeof scanData !== 'undefined' &&
495
+ scanData &&
496
+ Array.isArray(scanData.pagesScanned)
497
+ ? scanData.pagesScanned
498
+ : [];
499
+
500
+ if (page) {
501
+ const matchByUrl = scannedPages.find((p) => p && p.url === page.url && p.pageImagePath);
502
+ if (matchByUrl) return matchByUrl.pageImagePath;
503
+
504
+ const matchByTitle = scannedPages.find(
505
+ (p) => p && p.pageTitle === page.pageTitle && p.pageImagePath,
506
+ );
507
+ if (matchByTitle) return matchByTitle.pageImagePath;
508
+ }
509
+
510
+ return '';
511
+ }
512
+
513
+ function createCustomFlowContent(page, ruleInCategory) {
514
+ const pageScreenshot = getCustomFlowPageScreenshot(page, ruleInCategory);
515
+
490
516
  return `
491
517
  <div class="custom-flow-screenshot-container">
492
518
  <div class="custom-flow-thumb">
493
- <img
494
- src="${page.pageImagePath}"
495
- alt="Screenshot of ${page.url}"
496
- class="custom-flow-screenshot"
497
- onerror="this.onerror = null; this.remove();"
498
- >
519
+ ${
520
+ pageScreenshot
521
+ ? `<img
522
+ src="${pageScreenshot}"
523
+ alt="Screenshot of ${page.url}"
524
+ class="custom-flow-screenshot"
525
+ onerror="this.onerror = null; this.remove();"
526
+ >`
527
+ : ''
528
+ }
499
529
  </div>
500
530
  <div class="display-url-container">
501
531
  <div><a href="${page.url}" target="_blank">${page.url}</a></div>
@@ -538,6 +568,7 @@
538
568
 
539
569
  function setupCustomFlowScreenshot(accordion, page) {
540
570
  const customScreenshotElem = accordion.getElementsByClassName('custom-flow-screenshot')[0];
571
+ if (!customScreenshotElem) return;
541
572
 
542
573
  customScreenshotElem.onerror = function(event) {
543
574
  this.onerror = null;
@@ -1,21 +1,27 @@
1
1
  <script>
2
2
  document.addEventListener('click', function (e) {
3
- const btn = e.target.closest('.seg-pill');
3
+ const btn = e.target.closest('.seg-pill[role="tab"]');
4
4
  if (!btn) return;
5
5
 
6
- const container = btn.closest('.segmented-tabs');
6
+ const container = btn.closest('.segmented-tabs[role="tablist"]');
7
+ if (!container) return;
8
+
7
9
  const targetSel = btn.getAttribute('data-tab-target');
8
10
  const panel = document.querySelector(targetSel);
9
11
  if (!panel) return;
10
12
 
11
- container.querySelectorAll('.seg-pill').forEach((p) =>
12
- p.setAttribute('aria-selected', 'false')
13
- );
13
+ container.querySelectorAll('.seg-pill[role="tab"]').forEach((p) => {
14
+ p.setAttribute('aria-selected', 'false');
15
+ p.setAttribute('tabindex', '-1');
16
+ });
17
+
14
18
  btn.setAttribute('aria-selected', 'true');
19
+ btn.setAttribute('tabindex', '0');
15
20
 
16
21
  document
17
22
  .querySelectorAll('.seg-panels > [role="tabpanel"]')
18
23
  .forEach((p) => (p.hidden = true));
24
+
19
25
  panel.hidden = false;
20
26
  });
21
27