Skip to content

Fix missing ARIA attributes on dynamically inserted chapter rows#161

Merged
CyberSecDef merged 2 commits into
mainfrom
copilot/fix-missing-accessibility-attributes
Apr 9, 2026
Merged

Fix missing ARIA attributes on dynamically inserted chapter rows#161
CyberSecDef merged 2 commits into
mainfrom
copilot/fix-missing-accessibility-attributes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Dynamically inserted chapter rows (via "Add Before"/"Add After") were missing role="textbox", aria-label on editable cells, and aria-label on all action buttons — attributes present on template-rendered rows — leaving screen readers unable to identify cell purpose or button actions.

Changes

  • static/js/script.js
    • Extracted buildNewChapterRowHtml() helper, replacing the duplicated inline HTML strings in both btn-add-before and btn-add-after handlers
    • New rows now include full ARIA coverage matching the existing addChapterRow() pattern:
      • role="textbox" + aria-label on title and summary editable cells
      • aria-label on each button (move-up, move-down, add-before, add-after, delete-chapter)
      • aria-label on button group <div> elements
"<div class='editable-cell' contenteditable='true' data-field='title' role='textbox' aria-label='Chapter title'>New Chapter</div>"
// ...
"<button class='btn btn-sm btn-outline-danger btn-delete-chapter' title='Delete Chapter' aria-label='Delete chapter'>…</button>"

Generic labels (e.g. "Chapter title" rather than "Chapter 3 title") are used since renumberChapters() only updates visible text, not aria-label values.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.openai.com
    • Triggering command: /usr/bin/python python -m pytest tests/ -x -q --tb=short (dns block)
    • Triggering command: /usr/bin/python python -m pytest tests/ -q --tb=short (dns block)
    • Triggering command: /usr/bin/python python -m pytest tests/ --tb=short (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested review from Copilot and removed request for Copilot April 9, 2026 00:12
Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot April 9, 2026 00:18
Copilot AI changed the title [WIP] Fix missing accessibility attributes in dynamic chapter rows Fix missing ARIA attributes on dynamically inserted chapter rows Apr 9, 2026
Copilot AI requested a review from CyberSecDef April 9, 2026 00:19
@CyberSecDef CyberSecDef marked this pull request as ready for review April 9, 2026 00:20
Copilot AI review requested due to automatic review settings April 9, 2026 00:20
@CyberSecDef CyberSecDef merged commit 477aadf into main Apr 9, 2026
7 checks passed
@CyberSecDef CyberSecDef deleted the copilot/fix-missing-accessibility-attributes branch April 9, 2026 00:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes missing accessibility attributes on chapter rows that are inserted dynamically via “Add Before” / “Add After”, so screen readers can identify editable cells and action buttons consistently.

Changes:

  • Added buildNewChapterRowHtml() helper to centralize new-row markup for both insertion paths.
  • Ensured dynamically inserted rows include role="textbox" and aria-label on editable cells, plus aria-label on action buttons and button groups.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread static/js/script.js
Comment on lines +629 to +634
function buildNewChapterRowHtml() {
return (
"<tr>" +
"<td class='chapter-number'></td>" +
"<td><div class='editable-cell' contenteditable='true' data-field='title'>New Chapter</div></td>" +
"<td><div class='editable-cell' contenteditable='true' data-field='summary'>Enter chapter summary...</div></td>" +
"<td><div class='editable-cell' contenteditable='true' data-field='title' role='textbox' aria-label='Chapter title'>New Chapter</div></td>" +
"<td><div class='editable-cell' contenteditable='true' data-field='summary' role='textbox' aria-label='Chapter summary'>Enter chapter summary...</div></td>" +
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildNewChapterRowHtml() duplicates most of the markup already constructed in addChapterRow(), but with different escaping and ARIA-label conventions. To avoid the two templates drifting again (especially for accessibility attributes), consider extracting a single chapter-row builder that both addChapterRow() and the add-before/add-after handlers can use (e.g., parameterized by title/summary and optionally number).

Copilot uses AI. Check for mistakes.
Comment thread static/js/script.js
Comment on lines +633 to +641
"<td><div class='editable-cell' contenteditable='true' data-field='title' role='textbox' aria-label='Chapter title'>New Chapter</div></td>" +
"<td><div class='editable-cell' contenteditable='true' data-field='summary' role='textbox' aria-label='Chapter summary'>Enter chapter summary...</div></td>" +
"<td class='text-center'>" +
"<div class='btn-group btn-group-sm me-1' role='group'>" +
"<button class='btn btn-outline-secondary btn-move-up' title='Move Up'><i class='bi bi-arrow-up'></i></button>" +
"<button class='btn btn-outline-secondary btn-move-down' title='Move Down'><i class='bi bi-arrow-down'></i></button>" +
"<div class='btn-group btn-group-sm me-1' role='group' aria-label='Reorder chapter'>" +
"<button class='btn btn-outline-secondary btn-move-up' title='Move Up' aria-label='Move chapter up'><i class='bi bi-arrow-up'></i></button>" +
"<button class='btn btn-outline-secondary btn-move-down' title='Move Down' aria-label='Move chapter down'><i class='bi bi-arrow-down'></i></button>" +
"</div>" +
"<div class='btn-group btn-group-sm me-1' role='group'>" +
"<button class='btn btn-outline-success btn-add-before' title='Add Before'><i class='bi bi-plus-circle'></i></button>" +
"<button class='btn btn-outline-success btn-add-after' title='Add After'><i class='bi bi-plus-circle'></i></button>" +
"<div class='btn-group btn-group-sm me-1' role='group' aria-label='Insert around chapter'>" +
"<button class='btn btn-outline-success btn-add-before' title='Add Before' aria-label='Add chapter before'><i class='bi bi-plus-circle'></i></button>" +
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new rows use generic aria-label values (e.g., "Chapter title"), while rows created via addChapterRow() use numbered labels (e.g., "Chapter 3 title"). Since renumberChapters() only updates the visible number, moving/inserting chapters can leave the existing numbered aria-labels incorrect. Consider updating renumberChapters() (or adding a helper it calls) to also recompute all chapter-related ARIA labels (cells, button groups, and buttons) based on the current index so screen readers get accurate, consistent labels.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic Chapter Rows Missing Accessibility Attributes

3 participants