Repository navigation
review: warn when slides share a title - #2291
ChenzhuoJi wants to merge 1 commit into
Conversation
Slides that share a title are hard to tell apart for a screen-reader user navigating by title, so review.accessibility now reports every slide whose title another slide carries too. Titles are compared as they are read: case and spacing differences do not make a title a different one. A slide with no title keeps its existing "Missing slide title" report and is not also reported as a duplicate. Fixes storytold#2225
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
Changes needed (not certain):
Adds a 'Duplicate slide title' report to review.accessibility, matching titles regardless of case and spacing, with tests.
- crates/engine/src/cmd/review.rs:250: title_key folds case and whitespace; please confirm this matches how titles should be compared for this check.
- crates/engine/src/cmd/review.rs:268: the new entry adds a 'title' field; consumers of the report that expect only {slide, shape, issue} should be checked.
- crates/engine/src/cmd/review.rs:256: slides are collected and counted before the walk, so each duplicate is reported once per slide; untitled slides are left out of the count.
Claims checked:
- unverified: review.accessibility reports 'Duplicate slide title' for each slide whose title is shared, with the title in a new 'title' field. (crates/engine/src/cmd/review.rs:256-270 (diff) counts titles and pushes the entry; the surrounding code and the dialog that reads the report could not be read.)
- unverified: Titles differing only in case or spacing are the same title. (crates/engine/src/cmd/review.rs:250 title_key splits on whitespace, joins with single spaces and lowercases; sl.title() could not be read.)
- unverified: Untitled slides keep 'Missing slide title' and are not also reported as duplicates. (crates/engine/src/cmd/review.rs:259-268 (diff) skips empty trimmed titles in the count and in the if/else branch; not checked against sl.title() for placeholder prompt text.)
- unverified: The accessibility dialog already lists whatever the checker returns, so no UI change is needed. (crates/engine/src/cmd/review.rs:38 (diff) only changes the spec string; the dialog code could not be read.)
- unverified: Fixes issue 2225. (crates/engine/src/cmd/review.rs:256-270 (diff); the issue and the reference app behaviour could not be read.)
Reviewed at 97af600.
Recommendation: update the pull request; it will be reviewed again.
Slides that share a title are now reported by the accessibility checker, so a deck can be read by title without ambiguity.
Fixes #2225.
What the user saw
review.accessibilityreported nothing about two slides with the same title. A deck whose slides are all called "Results" passed the checker, and a screen-reader user navigating by title could not tell the slides apart.The cause
crates/engine/src/cmd/review.rschecked each slide on its own: a missing title, missing alternative text and low-contrast text. Nothing compared a slide's title with the other slides', so a title shared by several slides went unnoticed.What changed
review.accessibilitynow collects the title of every slide, counts how many slides carry each title, and reportsDuplicate slide titlefor each slide whose title is shared. The report carries the shared title in a newtitlefield, so a deck with more than one group of duplicates stays readable.Titles are compared as they are read: case and spacing differences do not make a title a different one ("Results" and "results " are the same title). Slides with no title keep their existing "Missing slide title" report and are not also reported as duplicates.
The change is one command in the engine, because that is where the check lives; the accessibility dialog already lists whatever the checker returns, so no UI change was needed.
Test
crates/engine/src/cmd/review.rs,accessibility_duplicate_title_tests:every_slide_that_shares_a_title_is_reported— a deck with two slides titled "Results" and one titled "Agenda" reports the two sharing the title and not the third.slides_without_a_title_are_not_reported_as_duplicates— untitled slides are reported as missing a title and not as duplicates.titles_that_differ_only_in_case_or_spacing_share_one_title— titles that differ only in case or spacing are one title.The first and the third fail without this change: with the fix reverted,
review.accessibilityreports noDuplicate slide titleat all.Verification
cargo fmt --all --check— passed.cargo clippy -p deckcraft-engine --all-targets -- -D warnings— passed, no warnings.cargo test -p deckcraft-engine— passed: 604 passed, 0 failed, 1 ignored (unit tests), 6 passed (tests/it), 8 passed (tests/show_paragraph_builds).cargo xtask wasm— passed.deckcraft-cli run --cmd-file a11y.txt --printon a deck with two slides titled "Results" and one titled "Agenda" printsreview.accessibility → [{"issue":"Missing slide title","slide":0},{"issue":"Duplicate slide title","slide":1,"title":"Results"},{"issue":"Duplicate slide title","slide":2,"title":"Results"}]— the two slides sharing the title are reported, the one with its own title is not, and the untitled slide keeps its existing report.
Summary by CodeRabbit