@govtechsg/oobee 0.10.87 → 0.10.88

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 (28) hide show
  1. package/.github/workflows/docker-push-ghcr.yml +49 -0
  2. package/DETAILS_OUTPUT_EXAMPLES.md +178 -0
  3. package/Dockerfile +6 -7
  4. package/dist/combine.js +1 -0
  5. package/dist/crawlers/commonCrawlerFunc.js +523 -2
  6. package/dist/crawlers/crawlLocalFile.js +2 -2
  7. package/dist/crawlers/custom/extractAndGradeText.js +1 -1
  8. package/dist/crawlers/custom/getAxeConfiguration.js +26 -21
  9. package/dist/crawlers/custom/gradeReadability.js +1 -1
  10. package/dist/npmIndex.js +16 -12
  11. package/dist/screenshotFunc/htmlScreenshotFunc.js +67 -0
  12. package/dist/static/ejs/partials/scripts/ruleModal/itemCardRenderer.ejs +7 -4
  13. package/dist/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +7 -4
  14. package/dist/static/ejs/partials/scripts/ruleModal/utilities.ejs +2 -1
  15. package/examples/oobee-test-details-runner.js +214 -0
  16. package/examples/test-violations.html +42 -0
  17. package/package.json +1 -1
  18. package/src/combine.ts +1 -0
  19. package/src/crawlers/commonCrawlerFunc.ts +625 -2
  20. package/src/crawlers/crawlLocalFile.ts +4 -1
  21. package/src/crawlers/custom/extractAndGradeText.ts +1 -1
  22. package/src/crawlers/custom/getAxeConfiguration.ts +25 -23
  23. package/src/crawlers/custom/gradeReadability.ts +1 -1
  24. package/src/npmIndex.ts +17 -12
  25. package/src/screenshotFunc/htmlScreenshotFunc.ts +81 -1
  26. package/src/static/ejs/partials/scripts/ruleModal/itemCardRenderer.ejs +7 -4
  27. package/src/static/ejs/partials/scripts/ruleModal/pageAccordionBuilder.ejs +7 -4
  28. package/src/static/ejs/partials/scripts/ruleModal/utilities.ejs +2 -1
@@ -0,0 +1,49 @@
1
+ name: Build and Push Docker Image to GHCR
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ release_tag:
7
+ description: 'Release tag for the image (e.g. 0.10.87)'
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ jobs:
16
+ build-and-push:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up QEMU
23
+ uses: docker/setup-qemu-action@v3
24
+
25
+ - name: Set up Docker Buildx
26
+ uses: docker/setup-buildx-action@v3
27
+
28
+ - name: Log in to GitHub Container Registry
29
+ uses: docker/login-action@v3
30
+ with:
31
+ registry: ghcr.io
32
+ username: ${{ github.actor }}
33
+ password: ${{ secrets.GITHUB_TOKEN }}
34
+
35
+ - name: Lowercase repository name
36
+ id: repo
37
+ run: echo "name=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
38
+
39
+ - name: Build and push multi-arch image
40
+ uses: docker/build-push-action@v6
41
+ with:
42
+ context: .
43
+ platforms: linux/amd64,linux/arm64
44
+ push: true
45
+ tags: |
46
+ ghcr.io/${{ steps.repo.outputs.name }}:${{ inputs.release_tag }}
47
+ ghcr.io/${{ steps.repo.outputs.name }}:latest
48
+ cache-from: type=gha
49
+ cache-to: type=gha,mode=max
@@ -0,0 +1,178 @@
1
+ # Enriched Details Output Examples
2
+
3
+ These are real outputs captured from `scanPage` against intentionally non-compliant test pages.
4
+ The **Details** panel in the HTML report renders the `message` field shown below.
5
+
6
+ ---
7
+
8
+ ## 1. `color-contrast` (WCAG AA — mustFix)
9
+
10
+ **Element:**
11
+ ```html
12
+ <p style="color: #999999; font-size: 14px;">This light gray text on white background fails AA contrast</p>
13
+ ```
14
+
15
+ **Details message:**
16
+ ```
17
+ Multiple text elements in this component fail WCAG 1.4.3 Color Contrast Minimum.
18
+ Audit all visible text in the snippet and update every failing foreground color so
19
+ normal text achieves at least 4.5:1 contrast against its actual background, with a
20
+ safety margin above the minimum where possible. Known failing combinations in this
21
+ snippet include foreground #999999 on #ffffff at 14px normal text (current contrast
22
+ 2.84, expected 4.5:1). Fix all failing text colors in the component, not just the
23
+ first reported element. Recommendation: To meet the required contrast ratio, for
24
+ foreground #999999 on background #ffffff (target 4.5:1), adjust foreground to #737373
25
+ (rgb(115, 115, 115)) or background to #2e2e2e (rgb(46, 46, 46)).
26
+ ```
27
+
28
+ **Element:**
29
+ ```html
30
+ <button style="background-color: #55aa99; color: #e8ffe8; font-size: 12px;">Low contrast button</button>
31
+ ```
32
+
33
+ **Details message:**
34
+ ```
35
+ Multiple text elements in this component fail WCAG 1.4.3 Color Contrast Minimum.
36
+ Audit all visible text in the snippet and update every failing foreground color so
37
+ normal text achieves at least 4.5:1 contrast against its actual background, with a
38
+ safety margin above the minimum where possible. Known failing combinations in this
39
+ snippet include foreground #e8ffe8 on #55aa99 at 12px normal text (current contrast
40
+ 2.61, expected 4.5:1). Fix all failing text colors in the component, not just the
41
+ first reported element. Recommendation: To meet the required contrast ratio, for
42
+ foreground #e8ffe8 on background #55aa99 (target 4.5:1), adjust foreground to #003a00
43
+ (rgb(0, 58, 0)) or background to #3d7a6e (rgb(61, 122, 110)).
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 2. `color-contrast-enhanced` (WCAG AAA — goodToFix)
49
+
50
+ **Element:**
51
+ ```html
52
+ <p style="color: #757575; font-size: 14px;">This text passes AA but fails AAA needs 7 to 1</p>
53
+ ```
54
+
55
+ **Details message:**
56
+ ```
57
+ Multiple text elements in this component fail WCAG 1.4.3 Color Contrast Minimum.
58
+ Audit all visible text in the snippet and update every failing foreground color so
59
+ normal text achieves at least 7:1 contrast against its actual background, with a
60
+ safety margin above the minimum where possible. Known failing combinations in this
61
+ snippet include foreground #757575 on #ffffff at 14px normal text (current contrast
62
+ 4.6, expected 7:1). Fix all failing text colors in the component, not just the first
63
+ reported element. Recommendation: To meet the required contrast ratio, for foreground
64
+ #757575 on background #ffffff (target 7:1), adjust foreground to #555555
65
+ (rgb(85, 85, 85)).
66
+ ```
67
+
68
+ **Element:**
69
+ ```html
70
+ <p style="color: #6b6b6b; font-size: 12px;">Small text needs 7 to 1 for AAA</p>
71
+ ```
72
+
73
+ **Details message:**
74
+ ```
75
+ Multiple text elements in this component fail WCAG 1.4.3 Color Contrast Minimum.
76
+ Audit all visible text in the snippet and update every failing foreground color so
77
+ normal text achieves at least 7:1 contrast against its actual background, with a
78
+ safety margin above the minimum where possible. Known failing combinations in this
79
+ snippet include foreground #6b6b6b on #ffffff at 12px normal text (current contrast
80
+ 5.32, expected 7:1). Fix all failing text colors in the component, not just the first
81
+ reported element. Recommendation: To meet the required contrast ratio, for foreground
82
+ #6b6b6b on background #ffffff (target 7:1), adjust foreground to #555555
83
+ (rgb(85, 85, 85)).
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 3. `target-size` (WCAG 2.5.8 — mustFix)
89
+
90
+ ### Example A: `content-box` elements (no WARNING)
91
+
92
+ **Element:**
93
+ ```html
94
+ <a href="/a" class="icon-link" style="width: 16px; height: 16px;">A</a>
95
+ ```
96
+
97
+ **Details message:**
98
+ ```
99
+ Fix any of the following:
100
+ Target has insufficient size (16px by 16px, should be at least 24px by 24px)
101
+ Target has insufficient space to its closest neighbors. Safe clickable space has a
102
+ diameter of 17px instead of at least 24px.
103
+ Computed hit area: 16px × 16px (box-sizing: content-box).
104
+ ```
105
+
106
+ ### Example B: `border-box` element with explicit inline width/height (WARNING appended)
107
+
108
+ **Element:**
109
+ ```html
110
+ <button style="width: 20px; height: 20px; padding: 0; box-sizing: border-box;">X</button>
111
+ ```
112
+
113
+ **Details message:**
114
+ ```
115
+ Fix any of the following:
116
+ Target has insufficient size (20px by 20px, should be at least 24px by 24px)
117
+ Target has insufficient space to its closest neighbors. Safe clickable space has a
118
+ diameter of 21px instead of at least 24px.
119
+ Computed hit area: 20px × 20px (box-sizing: border-box).
120
+ Tip: inline style sets width: 20px, height: 20px with box-sizing: border-box —
121
+ padding is included within those dimensions and will not increase the hit area. Fix:
122
+ remove the explicit width/height and use min-width: 24px; min-height: 24px instead,
123
+ or place the visual content in a child <span> element.
124
+ ```
125
+
126
+ ---
127
+
128
+ ## 4. `valid-lang` (mustFix)
129
+
130
+ **Element:**
131
+ ```html
132
+ <div lang="x-klingon">This section also has an invalid private-use lang tag with some sample text content for context.</div>
133
+ ```
134
+
135
+ **Details message:**
136
+ ```
137
+ Fix all of the following:
138
+ Value of lang attribute not included in the list of valid languages
139
+ Note: "x-klingon" uses a private-use "x-" prefix. axe-core's valid-lang rule also
140
+ rejects private-use subtags — you must use a registered IANA language code.
141
+ Original text: "This section also has an invalid private-use lang tag with some sample
142
+ text content for context.". Identify the actual language of this text and use its
143
+ registered BCP 47 code (e.g., lang="it" Italian, "es" Spanish, "fr" French,
144
+ "de" German, "zh" Chinese, "ja" Japanese, "ko" Korean, "pt" Portuguese, "ar" Arabic).
145
+ ```
146
+
147
+ ---
148
+
149
+ ## 5. `oobee-grading-text-contents` (WCAG AAA — needsReview)
150
+
151
+ **Element:**
152
+ ```html
153
+ <html lang="en">...</html>
154
+ ```
155
+
156
+ **Details message:**
157
+ ```
158
+ The text content is potentially difficult to read, with a Flesch-Kincaid Reading Ease
159
+ score of 33.92. Difficult — college level or above.
160
+ ```
161
+
162
+ ### Score interpretation table (appended inline after the numeric score)
163
+
164
+ Only scores in the range 1–50 trigger a violation (scores > 50 pass, scores ≤ 0 are filtered out).
165
+
166
+ | Score Range | Interpretation appended to message |
167
+ |---|---|
168
+ | 31–50 | Difficult — college level or above. |
169
+ | 1–30 | Very difficult — best understood by university graduates. |
170
+
171
+ ---
172
+
173
+ ## Notes
174
+
175
+ - **color-contrast** and **color-contrast-enhanced** messages include computed color recommendations using WCAG relative luminance math with a binary search on HSL lightness.
176
+ - **target-size** appends `Computed hit area` and, when `box-sizing: border-box` with explicit inline dimensions is detected, a `Tip` explaining why padding won't help.
177
+ - **valid-lang** appends a `NOTE` when the lang value uses a private-use `x-*` prefix, plus the element's text content (up to 120 chars) to help identify the correct language code.
178
+ - **oobee-grading-text-contents** now appends a plain-language interpretation of the Flesch-Kincaid score immediately after the numeric value.
package/Dockerfile CHANGED
@@ -2,13 +2,12 @@
2
2
  # Node version is v22
3
3
  FROM mcr.microsoft.com/playwright:v1.58.2-noble
4
4
 
5
- # Installation of packages for oobee and runner (locked versions from build log)
6
- RUN apt-get update && apt-get install -y \
7
- git=1:2.43.0-1ubuntu7.3 \
8
- git-man=1:2.43.0-1ubuntu7.3 \
9
- unzip=6.0-28ubuntu4.1 \
10
- zip=3.0-13ubuntu0.2 \
11
- && rm -rf /var/lib/apt/lists/*
5
+ # Installation of packages for oobee
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git \
8
+ unzip \
9
+ zip && \
10
+ rm -rf /var/lib/apt/lists/*
12
11
 
13
12
  WORKDIR /app/oobee
14
13
 
package/dist/combine.js CHANGED
@@ -117,6 +117,7 @@ const combineRun = async (details, deviceToScan) => {
117
117
  includeScreenshots,
118
118
  extraHTTPHeaders,
119
119
  scanDuration,
120
+ ruleset,
120
121
  });
121
122
  if (localFileResult) {
122
123
  if ('urlsCrawled' in localFileResult) {