Skip to content

Comics roles - #89

Merged
JayPanoz merged 8 commits into
mainfrom
comics-roles
Nov 24, 2026
Merged

JayPanoz merged 8 commits into
mainfrom
comics-roles

Conversation

@JayPanoz

@JayPanoz JayPanoz commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Add handling of comics roles e.g. panel, bubble, their verbosity and contextualisation, etc.

It also fixes the order of description and children.

Depends on readium/ts-toolkit#304 for fixtures.

@JayPanoz
JayPanoz marked this pull request as ready for review November 24, 2026 10:45
@JayPanoz
JayPanoz requested a balanced review from Copilot November 24, 2026 10:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Description and value folding still use dropped roles, causing alt text and dialogue content to be omitted from announcements.

2 open issues
What changed in this PR

Adds comics-role support to Readium’s speech extraction pipeline and changes descriptions to play before node content.

Changes:

  • Adds announcements, verbosity settings, block boundaries, and role overrides for panels, panel groups, speech bubbles, and sounds.
  • Updates description ordering and related fixture expectations.
  • Upgrades Readium dependencies and documents the new behavior.
File Description
src/​utterances/​walk.ts Emits descriptions before content.
src/​utterances/​roles.ts Defines comics block roles and overrides.
src/​utterances/​contextualization.ts Supports wildcard role overrides.
src/​preferences/​verbosityTables.ts Assigns comics roles to verbosity presets.
package.json Upgrades Readium dependencies.
package-lock.json Locks updated dependency versions.
locales/​en.json Adds English comics announcements.
fixtures/​sound-epub-type/​utterances.json Adds sound announcement expectations.
fixtures/​panel-svg-epub-type/​utterances.json Covers SVG panel announcements and skipping.
fixtures/​panel-object-role-img/​utterances.json Covers panels with image roles.
fixtures/​panel-group-epub-type/​utterances.json Covers panel groups and nested panels.
fixtures/​panel-epub-type/​utterances.json Covers panel descriptions and dialogue.
fixtures/​language-labelledby-target-aria-label/​utterances.json Updates localized label ordering.
fixtures/​language-describedby-shared/​utterances.json Updates shared-description ordering.
fixtures/​figure-describedby/​utterances.json Places figure descriptions before content.
fixtures/​figure-credit-nested-in-aria-labelledby-caption/​utterances.json Updates caption, image, and credit ordering.
fixtures/​figure-aria-label-caption/​utterances.json Updates figure label ordering.
fixtures/​description-roleless-wrapper/​utterances.json Places wrapper descriptions before children.
fixtures/​description-roleless-lone-child/​utterances.json Updates single-child description ordering.
fixtures/​bubble-epub-type/​utterances.json Adds speech-bubble announcement expectations.
docs/​Verbosity.md Documents comics verbosity settings.
docs/​UtteranceExtraction.md Documents comics overrides and block roles.
CHANGELOG.md Records comics support and ordering changes.

Review effort: Balanced

Comment thread src/utterances/roles.ts Resolved
Comment thread src/utterances/walk.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Mixed comics and cell roles can silently drop text content because value folding still checks the original roles rather than the retained roles.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve value folding when filtering cell roles

src/​utterances/​walk.ts:439

When a comics role shares a node with cell or rowheader, this removes the value-folding announcement, but foldsValue below still checks the original roles. A node with role: ["cell", "bubble"] and text "Hello", extracted with contextualize: ["bubble"], consequently emits only “Speech bubble.” and loses its content. Use keptRoles.some(...) instead of roles.some(...) in the foldsValue condition at line 500, and add regression tests for both cell roles.

2 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Competing wildcard contextualizations can drop each other’s roles, suppressing both requested announcements for nodes with multiple comics roles.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Prevent wildcard roles from dropping each other's contextualizations

src/​utterances/​contextualization.ts:37

When a node carries two comics roles, such as role: ["bubble", "sound"], enabling both contextualizations (as under most verbosity) makes each wildcard drop the other. This leaves keptRoles empty, so neither requested announcement is spoken. Define precedence between competing wildcard roles, or exempt them from dropping one another, and add a regression test for this combination.

Review effort: Balanced

@JayPanoz
JayPanoz merged commit d4362c7 into main Nov 24, 2026
@github-project-automation github-project-automation Bot moved this from Draft to Done in Readium Speech Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants