@govtechsg/oobee 0.10.92 → 0.10.94

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 (70) hide show
  1. package/AGENTS.md +34 -0
  2. package/README.md +19 -0
  3. package/dist/cli.js +3 -2
  4. package/dist/combine.js +4 -4
  5. package/dist/constants/common.js +136 -49
  6. package/dist/crawlers/commonCrawlerFunc.js +54 -2
  7. package/dist/crawlers/crawlDomain.js +9 -2
  8. package/dist/crawlers/crawlIntelligentSitemap.js +9 -4
  9. package/dist/crawlers/crawlSitemap.js +14 -2
  10. package/dist/crawlers/custom/utils.js +22 -9
  11. package/dist/crawlers/guards/urlGuard.js +19 -1
  12. package/dist/crawlers/runCustom.js +8 -2
  13. package/dist/generateOobeeClientScanner.js +1 -1
  14. package/dist/mergeAxeResults/itemsStore.js +32 -3
  15. package/dist/static/ejs/partials/components/allIssues/CategoryBadges.ejs +3 -0
  16. package/dist/static/ejs/partials/components/allIssues/IssuesTable.ejs +3 -3
  17. package/dist/static/ejs/partials/components/header/aboutScanModal/AboutScanModal.ejs +1 -1
  18. package/dist/static/ejs/partials/components/header/aboutScanModal/ScanConfiguration.ejs +3 -3
  19. package/dist/static/ejs/partials/components/header/aboutScanModal/ScanDetails.ejs +34 -27
  20. package/dist/static/ejs/partials/components/ruleModal/ruleOffcanvas.ejs +1 -0
  21. package/dist/static/ejs/partials/components/scannedPagesSegmentedTabs.ejs +7 -0
  22. package/dist/static/ejs/partials/components/wcagCoverageDetails.ejs +5 -5
  23. package/dist/static/ejs/partials/scripts/header/aboutScanModal/AboutScanModal.ejs +3 -3
  24. package/dist/static/ejs/partials/scripts/prioritiseIssues/PrioritiseIssues.ejs +21 -19
  25. package/dist/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +39 -8
  26. package/dist/static/ejs/partials/scripts/scannedPagesSegmentedTabs.ejs +11 -5
  27. package/dist/static/ejs/partials/scripts/screenshotLightbox.ejs +49 -31
  28. package/dist/static/ejs/partials/styles/header/SiteInfo.ejs +1 -1
  29. package/dist/static/ejs/partials/styles/header/aboutScanModal/ScanDetails.ejs +36 -16
  30. package/dist/static/ejs/partials/styles/prioritiseIssues/PrioritiseIssues.ejs +22 -1
  31. package/dist/static/ejs/partials/styles/styles.ejs +1 -1
  32. package/dist/static/ejs/partials/styles/wcagCompliance/WcagGaugeBar.ejs +6 -0
  33. package/dist/static/ejs/partials/styles/wcagCompliance.ejs +5 -4
  34. package/dist/static/ejs/partials/styles/wcagCoverageDetails.ejs +6 -1
  35. package/oobee-client-scanner.js +4 -4
  36. package/package.json +2 -2
  37. package/src/cli.ts +3 -2
  38. package/src/combine.ts +4 -2
  39. package/src/constants/common.ts +131 -35
  40. package/src/crawlers/commonCrawlerFunc.ts +56 -2
  41. package/src/crawlers/crawlDomain.ts +11 -1
  42. package/src/crawlers/crawlIntelligentSitemap.ts +10 -4
  43. package/src/crawlers/crawlSitemap.ts +19 -2
  44. package/src/crawlers/custom/utils.ts +26 -13
  45. package/src/crawlers/guards/urlGuard.ts +18 -1
  46. package/src/crawlers/runCustom.ts +10 -1
  47. package/src/generateOobeeClientScanner.ts +1 -1
  48. package/src/mergeAxeResults/itemsStore.ts +37 -3
  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/testStaticJSScanner.html +1 -1
  70. /package/{d5e2f6a7-0279-41a3-8763-844970cdf0ba.txt → 67e8137b-1939-4253-8f11-a82bc833cfcb.txt} +0 -0
@@ -1,6 +1,6 @@
1
1
  import crawlee, { EnqueueStrategy, RequestList } from 'crawlee';
2
2
  import { CrawlRateController } from './crawlRateController.js';
3
- import { createCrawleeSubFolders, getPreLaunchHook, preNavigationHooks, runAxeScript, } from './commonCrawlerFunc.js';
3
+ import { createCrawleeSubFolders, getPreLaunchHook, preNavigationHooks, runAxeScript, splitAuthHeaders, } from './commonCrawlerFunc.js';
4
4
  import constants, { STATUS_CODE_METADATA, guiInfoStatusTypes, disallowedListOfPatterns, FileTypes, } from '../constants/constants.js';
5
5
  import { getLinksFromSitemap, getPlaywrightLaunchOptions, isSkippedUrl, waitForPageLoaded, isFilePath, } from '../constants/common.js';
6
6
  import { areLinksEqual, isFollowStrategy, isWhitelistedContentType, normUrl, register } from '../utils.js';
@@ -13,6 +13,7 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
13
13
  let durationExceeded = false;
14
14
  let isAbortingScan = false;
15
15
  const rateController = new CrawlRateController(maxRequestsPerCrawl, specifiedMaxConcurrency || constants.maxConcurrency);
16
+ const initialNoSuccessFailureAbortThreshold = Math.max(5, Math.min(maxRequestsPerCrawl, 25));
16
17
  if (fromCrawlIntelligentSitemap) {
17
18
  dataset = datasetFromIntelligent;
18
19
  urlsCrawled = urlsCrawledFromIntelligent;
@@ -33,6 +34,7 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
33
34
  const isScanPdfs = [FileTypes.All, FileTypes.PdfOnly].includes(fileTypes);
34
35
  const { playwrightDeviceDetailsObject } = viewportSettings;
35
36
  const { maxConcurrency } = constants;
37
+ const { nonAuthHeaders, httpCredentials } = splitAuthHeaders(extraHTTPHeaders);
36
38
  const requestList = await RequestList.open({
37
39
  sources: linksFromSitemap,
38
40
  });
@@ -53,11 +55,15 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
53
55
  ...playwrightDeviceDetailsObject,
54
56
  ...(process.env.OOBEE_USER_AGENT && { userAgent: process.env.OOBEE_USER_AGENT }),
55
57
  ...(process.env.OOBEE_DISABLE_BROWSER_DOWNLOAD && { acceptDownloads: false }),
58
+ ...(nonAuthHeaders && { extraHTTPHeaders: nonAuthHeaders }),
59
+ ...(httpCredentials && { httpCredentials }),
56
60
  };
57
61
  },
58
62
  ],
59
63
  },
60
64
  requestList,
65
+ maxRequestRetries: 3,
66
+ maxSessionRotations: 1,
61
67
  postNavigationHooks: [
62
68
  async ({ page }) => {
63
69
  try {
@@ -104,6 +110,7 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
104
110
  },
105
111
  ],
106
112
  preNavigationHooks: [
113
+ ...preNavigationHooks(extraHTTPHeaders),
107
114
  async ({ request, page }, gotoOptions) => {
108
115
  const url = request.url.toLowerCase();
109
116
  const isNotSupportedDocument = disallowedListOfPatterns.some(pattern => url.startsWith(pattern));
@@ -114,7 +121,6 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
114
121
  // console.log(`[SKIP] Not supported: ${request.url}`);
115
122
  return;
116
123
  }
117
- preNavigationHooks(extraHTTPHeaders);
118
124
  },
119
125
  ],
120
126
  requestHandlerTimeoutSecs: 90,
@@ -310,6 +316,12 @@ const crawlSitemap = async ({ sitemapUrl, randomToken, host, viewportSettings, m
310
316
  httpStatusCode: typeof status === 'number' ? status : 0,
311
317
  });
312
318
  crawlee.log.error(`Failed Request - ${request.url}: ${request.errorMessages}`);
319
+ if (urlsCrawled.scanned.length === 0 &&
320
+ urlsCrawled.error.length >= initialNoSuccessFailureAbortThreshold) {
321
+ consoleLogger.info(`Aborting sitemap crawl: ${urlsCrawled.error.length} failed pages with 0 successful scans.`);
322
+ isAbortingScan = true;
323
+ crawler.autoscaledPool?.abort();
324
+ }
313
325
  },
314
326
  maxRequestsPerCrawl: Infinity,
315
327
  maxConcurrency: specifiedMaxConcurrency || maxConcurrency,
@@ -1064,15 +1064,28 @@ export const initNewPage = async (page, pageClosePromises, processPageParams, pa
1064
1064
  return;
1065
1065
  const allowed = isOverlayAllowed(page.url(), processPageParams.entryUrl);
1066
1066
  if (!allowed) {
1067
- await Promise.race([
1068
- removeOverlayMenu(page),
1069
- new Promise((_, reject) => {
1070
- setTimeout(() => {
1071
- reject(new Error(`removeOverlayMenu timed out after ${OVERLAY_OPERATION_TIMEOUT_MS}ms`));
1072
- }, OVERLAY_OPERATION_TIMEOUT_MS);
1073
- }),
1074
- ]);
1075
- return;
1067
+ // On macOS and Windows the custom flow always runs headful.
1068
+ // The URL guard (urlGuard.ts) intercepts non-http/https navigations
1069
+ // and calls page.goto(safeUrl). Do NOT remove the overlay here —
1070
+ // removing it causes it to stay permanently disabled if the redirect
1071
+ // races ahead of the next reconcile cycle.
1072
+ // Instead, fall through to the hasOverlay / addOverlayMenu block so
1073
+ // the overlay is (re-)injected even on transient non-http/https URLs
1074
+ // (e.g. file://, about:blank) and again after the guard's redirect.
1075
+ const isDesktopHost = process.platform === 'darwin' || process.platform === 'win32';
1076
+ if (!isDesktopHost) {
1077
+ // On Linux / Docker: remove overlay for non-http/https URLs and stop.
1078
+ await Promise.race([
1079
+ removeOverlayMenu(page),
1080
+ new Promise((_, reject) => {
1081
+ setTimeout(() => {
1082
+ reject(new Error(`removeOverlayMenu timed out after ${OVERLAY_OPERATION_TIMEOUT_MS}ms`));
1083
+ }, OVERLAY_OPERATION_TIMEOUT_MS);
1084
+ }),
1085
+ ]);
1086
+ return;
1087
+ }
1088
+ // Desktop hosts: skip removal and fall through to re-add overlay.
1076
1089
  }
1077
1090
  const hasOverlay = await page.evaluate(() => Boolean(document.querySelector('#oobeeShadowHost')));
1078
1091
  consoleLogger.info(`Overlay state (${trigger}): ${hasOverlay}`);
@@ -30,8 +30,20 @@ export function addUrlGuardScript(context, opts = {}) {
30
30
  // page may have closed before addInitScript completed; safe to ignore
31
31
  });
32
32
  const restoreToSafeUrl = async (page, attemptedUrl) => {
33
+ const safeUrl = lastAllowedUrlByPage.get(page) || fallbackUrl || 'about:blank';
34
+ // Only redirect if the safe URL is itself an allowed (http/https) URL.
35
+ // If the entry URL is file:// (e.g. scanning a local HTML file), the
36
+ // fallback is also file://, and redirecting would create an infinite loop:
37
+ // file:// → restoreToSafeUrl → file:// → framenavigated → restoreToSafeUrl → …
38
+ try {
39
+ const safeObj = new URL(safeUrl);
40
+ if (!ALLOWED_PROTOCOLS.has(safeObj.protocol))
41
+ return;
42
+ }
43
+ catch {
44
+ return;
45
+ }
33
46
  try {
34
- const safeUrl = lastAllowedUrlByPage.get(page) || fallbackUrl || 'about:blank';
35
47
  await page.goto(safeUrl, { waitUntil: 'domcontentloaded' });
36
48
  }
37
49
  catch {
@@ -53,6 +65,12 @@ export function addUrlGuardScript(context, opts = {}) {
53
65
  lastAllowedUrlByPage.set(page, urlObj.toString());
54
66
  return;
55
67
  }
68
+ // Skip browser-internal transitional states (about:blank, about:srcdoc, etc.).
69
+ // page.goto() navigates through about:blank before loading the target URL.
70
+ // Redirecting from about: creates an infinite loop:
71
+ // restoreToSafeUrl → page.goto(safeUrl) → about:blank → restoreToSafeUrl → …
72
+ if (urlObj.protocol === 'about:')
73
+ return;
56
74
  await restoreToSafeUrl(page, urlStr);
57
75
  });
58
76
  };
@@ -1,5 +1,5 @@
1
1
  /* eslint-env browser */
2
- import { createCrawleeSubFolders } from './commonCrawlerFunc.js';
2
+ import { createCrawleeSubFolders, splitAuthHeaders, addAuthRouteHandler } from './commonCrawlerFunc.js';
3
3
  import { cleanUpAndExit, register, registerSoftClose } from '../utils.js';
4
4
  import constants, { getIntermediateScreenshotsPath, guiInfoStatusTypes, } from '../constants/constants.js';
5
5
  import { initNewPage, log } from './custom/utils.js';
@@ -18,7 +18,7 @@ export class ProcessPageParams {
18
18
  this.randomToken = randomToken;
19
19
  }
20
20
  }
21
- const runCustom = async (url, randomToken, browserToRun, userDataDirectory, viewportSettings, blacklistedPatterns, includeScreenshots, initialCustomFlowLabel) => {
21
+ const runCustom = async (url, randomToken, browserToRun, userDataDirectory, viewportSettings, blacklistedPatterns, includeScreenshots, initialCustomFlowLabel, extraHTTPHeaders) => {
22
22
  // checks and delete datasets path if it already exists
23
23
  process.env.CRAWLEE_STORAGE_DIR = randomToken;
24
24
  const urlsCrawled = { ...constants.urlsCrawledObj };
@@ -47,6 +47,7 @@ const runCustom = async (url, randomToken, browserToRun, userDataDirectory, view
47
47
  ...baseArgs.filter(a => !a.startsWith('--window-size') && a !== '--start-maximized'),
48
48
  ...customArgs,
49
49
  ];
50
+ const { authHeader, nonAuthHeaders, httpCredentials } = splitAuthHeaders(extraHTTPHeaders);
50
51
  const context = await constants.launcher.launchPersistentContext(userDataDirectory, {
51
52
  ...baseLaunchOptions,
52
53
  args: mergedArgs,
@@ -56,7 +57,12 @@ const runCustom = async (url, randomToken, browserToRun, userDataDirectory, view
56
57
  viewport: null,
57
58
  ...(hasCustomViewport ? contextDeviceOptions : {}),
58
59
  userAgent: process.env.OOBEE_USER_AGENT || deviceUserAgent,
60
+ ...(nonAuthHeaders && { extraHTTPHeaders: nonAuthHeaders }),
61
+ ...(httpCredentials && { httpCredentials }),
59
62
  });
63
+ if (authHeader) {
64
+ await addAuthRouteHandler(context, url, authHeader);
65
+ }
60
66
  register(context);
61
67
  processPageParams.stopAll = async () => {
62
68
  try {
@@ -51,7 +51,7 @@ const SENTRY_NODE_VERSION = (() => {
51
51
  return _require('@sentry/node/package.json').version;
52
52
  }
53
53
  catch {
54
- return '9.47.1'; // safe fallback matching currently installed version
54
+ return '10.58.0'; // safe fallback matching currently installed version
55
55
  }
56
56
  })();
57
57
  // ---------------------------------------------------------------------------
@@ -1,9 +1,11 @@
1
1
  import fs from 'fs-extra';
2
2
  import path from 'path';
3
3
  import readline from 'readline';
4
+ import { consoleLogger } from '../logs.js';
4
5
  export class ItemsStore {
5
6
  constructor(storagePath) {
6
7
  this.ensuredDirs = new Set();
8
+ this.fileWriteQueues = new Map();
7
9
  this.basePath = path.join(storagePath, 'tmp-items');
8
10
  }
9
11
  sanitizeRuleId(ruleId) {
@@ -22,8 +24,25 @@ export class ItemsStore {
22
24
  async appendPageItems(category, ruleId, entry) {
23
25
  await this.ensureDir(category);
24
26
  const filePath = this.getRuleFilePath(category, ruleId);
25
- const line = JSON.stringify(entry) + '\n';
26
- await fs.appendFile(filePath, line, 'utf8');
27
+ let line = JSON.stringify(entry);
28
+ // JSON.stringify should never produce literal newlines inside strings, but HTML content
29
+ // from page evaluation may contain edge-case characters (e.g. unescaped control chars in
30
+ // non-spec-compliant innerHTML). Strip any embedded \r or \n that would break JSONL format readline parsing.
31
+ line = line.replace(/[\n\r]/g, (match) => {
32
+ if (match === '\n')
33
+ return '\\n';
34
+ if (match === '\r')
35
+ return '\\r';
36
+ return match;
37
+ });
38
+ line += '\n';
39
+ // Serialize writes per rule file to avoid concurrent append interleaving/truncation.
40
+ const previous = this.fileWriteQueues.get(filePath) ?? Promise.resolve();
41
+ const next = previous.then(() => fs.appendFile(filePath, line, 'utf8'));
42
+ this.fileWriteQueues.set(filePath, next.catch(() => {
43
+ // Keep queue alive for subsequent writes.
44
+ }));
45
+ await next;
27
46
  }
28
47
  async *readRuleItems(category, ruleId) {
29
48
  const filePath = this.getRuleFilePath(category, ruleId);
@@ -31,10 +50,19 @@ export class ItemsStore {
31
50
  return;
32
51
  const fileStream = fs.createReadStream(filePath, { encoding: 'utf8' });
33
52
  const rl = readline.createInterface({ input: fileStream, crlfDelay: Infinity });
53
+ let lineNumber = 0;
34
54
  for await (const line of rl) {
35
- if (line.trim()) {
55
+ lineNumber += 1;
56
+ if (!line.trim())
57
+ continue;
58
+ try {
36
59
  yield JSON.parse(line);
37
60
  }
61
+ catch (error) {
62
+ // Tolerate malformed/truncated JSONL lines (e.g. interrupted append) so report generation can continue.
63
+ const preview = line.slice(0, 200);
64
+ consoleLogger.warn(`Skipping malformed itemsStore JSONL line ${lineNumber} in ${filePath}: ${error.message}. Content preview: ${preview}`);
65
+ }
38
66
  }
39
67
  }
40
68
  async readRuleItemsMap(category, ruleId) {
@@ -46,6 +74,7 @@ export class ItemsStore {
46
74
  return map;
47
75
  }
48
76
  async cleanup() {
77
+ await Promise.all(this.fileWriteQueues.values());
49
78
  await fs.rm(this.basePath, { recursive: true, force: true });
50
79
  }
51
80
  }
@@ -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');