Skip to content

Commit 4a43282

Browse files
Merge pull request #332 from coding-for-reproducible-research/accessibility_submit_button
Accessibility Submit Button for Search Bar
2 parents 635d784 + d73d916 commit 4a43282

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

.github/workflows/accessibility.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
9191
- name: Run Pa11y CI on changed pages only and save output
9292
id: run_pa11y
93-
shell: bash # <-- this fixes the mapfile error
93+
shell: bash
9494
run: |
9595
num_files=$(jq length pa11y_targets.json)
9696
touch pa11y_output.md
@@ -101,24 +101,33 @@ jobs:
101101
echo "### 🚦 Pa11y Accessibility Report" > pa11y_output.md
102102
echo "" >> pa11y_output.md
103103
104-
# Deduplicate HTML targets and read into array
105104
mapfile -t html_files < <(jq -r '.[]' pa11y_targets.json | sort -u)
105+
total_files=${#html_files[@]}
106+
107+
for i in "${!html_files[@]}"; do
108+
file="${html_files[$i]}"
109+
current_index=$((i + 1))
110+
echo "🔎 Checking $current_index of $total_files: $file"
106111
107-
for file in "${html_files[@]}"; do
108112
echo "#### 📄 $file" >> pa11y_output.md
109113
echo '```' >> pa11y_output.md
114+
110115
result=$(npx pa11y-ci --reporter cli --config pa11yci.js "file://$(pwd)/$file" 2>&1 || true)
111116
echo "$result" >> pa11y_output.md
112117
echo '```' >> pa11y_output.md
113118
114-
# Attribution line for accessibility error source
115119
base=$(basename "$file" .html)
116-
echo "_⚠️ This issue likely originates from \`${base}.md\` or \`${base}.ipynb\`, which is used to generate this HTML file._" >> pa11y_output.md
120+
echo "_⚠️ Any errors likely originates from the source file (e.g., \`filename.md\`, \`filename.ipynb\`) used to generate the HTML._" >> pa11y_output.md
117121
echo "" >> pa11y_output.md
118122
done
119123
fi
120124
121125
126+
- name: 🔍 Debug comment body
127+
run: |
128+
echo "------- BEGIN COMMENT BODY -------"
129+
cat pa11y_output.md
130+
echo "-------- END COMMENT BODY --------"
122131
123132
- name: Debug GitHub context
124133
run: |

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ html:
3131
- _static/remove_prev_next_bottom_buttons.css
3232
extra_js:
3333
- _static/overlay-label-accessibility.js
34+
- _static/search_bar_submit_button.js
3435

3536

3637
launch_buttons:

_static/search_bar_submit_button.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Add a submit button to the search form for accessibility
2+
document.addEventListener("DOMContentLoaded", function () {
3+
const searchForm = document.querySelector('form.bd-search');
4+
if (searchForm) {
5+
const submitBtn = document.createElement('button');
6+
submitBtn.type = 'submit';
7+
submitBtn.className = 'visually-hidden'; // Keeps it hidden visually but accessible to screen readers
8+
submitBtn.textContent = 'Submit Search';
9+
searchForm.appendChild(submitBtn);
10+
}
11+
});

home_page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ You can contact the CfRR team at the following email: [codingforreproduciblerese
1313

1414
Please register your interest in a particular course by completing the relevant form on the Workshop Schedule and Signup page available [here](cfrr_program_details/courses_overview.ipynb).
1515

16-
For more details on the use of this website, please go to ['How to use this website'](cfrr_program_details/how_to_use_CfRR.ipynb).
16+
For more details on the structure and use of this website, please go to ['How to use this website'](cfrr_program_details/how_to_use_CfRR.ipynb).

0 commit comments

Comments
 (0)