Add table accessibility tagging (Table/TR/TH/TD structure elements)#164
Open
craigmcnamara wants to merge 1 commit intoprawnpdf:masterfrom
Open
Add table accessibility tagging (Table/TR/TH/TD structure elements)#164craigmcnamara wants to merge 1 commit intoprawnpdf:masterfrom
craigmcnamara wants to merge 1 commit intoprawnpdf:masterfrom
Conversation
When rendering on a tagged Prawn::Document (marked: true), tables now automatically emit PDF structure elements: - <Table> wraps the entire table - <TR> wraps each row - <TH> with /Scope /Column for header cells - <TD> for data cells Header cells are detected automatically from the table's header: option. Backgrounds and borders are wrapped as /Artifact (decorative content not read by screen readers). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds automatic PDF structure tagging for tables when rendered on a tagged
Prawn::Document(one created withmarked: true).When tagged mode is active,
pdf.table(data, header: true)automatically emits:<Table>wrapping the entire table<TR>wrapping each row<TH>with/Scope /Columnfor cells in header rows<TD>for data cells/Artifact(excluded from screen readers)No API changes required — existing
pdf.table()calls gain accessibility tagging automatically.Changes:
Table#draw— wraps instructure_container(:Table)when taggedCell.draw_cells— emits<TR>per row,<TH>/<TD>per cell; backgrounds/borders as artifactsCell#header?/Cell#is_header_cell— accessor for header cell detectionTable#mark_header_cells— auto-marks cells in header rows based onheader:optionGemfile— supportsGemfile.localfor local gem overridesDepends on prawnpdf/prawn#1391 and prawnpdf/pdf-core#67.
Addresses #78
Test plan
🤖 Generated with Claude Code