Add empty-table-header-cell docs-lint rule + fix 4 affected files#39
Merged
Conversation
… rules
Two new HTML-table rules in the existing tables rule module:
empty-table-header-cell (error) An empty <th></th> in the
header row of an HTML table creates
a phantom column when rendered. This
is the bug fixed on ArrayGrid by
upstream commit 9476417 — the
previous version had 8 trailing
empty <th> placeholders padding the
header out to 13 columns, producing
8 blank columns in the published
page. The rule catches this class
of bug repo-wide.
html-row-cell-count-mismatch (error) Fallback for the same class
of bug when the phantom cells are
not empty: per top-level table,
count <th>/<td> cells in each <tr>
and flag rows whose count differs
from the first row.
Both rules have conservative exceptions to avoid false positives:
- Row-header tables (tables that use <th scope="row"> on body row
labels) are recognized as comparison/cross-tab tables where the
empty top-left corner <th> is semantically correct, not a phantom
column. Rule A is skipped on those tables.
- Rule B is skipped on tables with nested <table> elements (cell
counts would otherwise sweep in nested-table cells).
- Rule B is skipped on tables that use rowspan or colspan > 1, since
a raw cell-count comparison can't reason about merged cells.
The Adaptive streaming protocols and Supported video codecs tables on media/index.md are both row-label comparison tables: each row labels a feature/spec (Audio Codecs, Aspect Ratio, etc.) and each column compares protocols/codecs. The previous markup used a <td> for the row-label cell and an empty <th></th> as the corner. That works visually but is semantically incorrect: the row labels are headers (they describe their row), not data. Convert the markup to use <th scope="row"> on each body row's label cell and <th scope="col"> on the column-header cells. The empty corner <th> stays as the intersection of row-header and column- header axes; it has no row to label. This is the standard pattern recommended by HTML accessibility guidance — assistive tech can now announce "Audio Codecs, DASH, AAC, DTS, DD, DD+" with full row + column context, and ReadMe styles the row-header cells distinctly, which improves visual scannability. Also reformatted the source HTML with 2-space indentation per level for readability (no change to rendered output).
The 8 binary-format tables in this file each described a byte-stream
entry layout, where the second column showed the entry-type bits
(Bits 2..0 of the entry tag, with Literal 0x0..0x5 distinguishing
each entry kind). The header for that column was left blank in every
table, producing a phantom column for the reader.
This change adds an explicit header for the type-marker column:
- 7 tables get an "Entry type" header for the Bits 2..0 column.
- The Memory operation table additionally gets an "Operation type"
header for the Bits 4..3 column (which differentiates alloc /
free / free_realloc within a memory entry).
Also reformatted each table with 2-space indentation per level,
added scope="col" on all header cells for accessibility, and fixed
two minor typos in the original body text (a stray ") " and an
extra space).
The Fields table on this page had three overlapping problems:
1. JSX-style <Table align={[15 entries]}> with 10 trailing empty
<th></th> cells padding the header out to 15 columns. The
published page rendered with 10 phantom blank columns extending
off to the right (same class of bug as the May 11 ArrayGrid fix
in 9476417).
2. The loadStatus row had a legitimate nested <table> inside its
Description cell (Value/Meaning rows for "none"/"loading"/"ready"
/"failed"). But the contents of that nested table were also
duplicated as 10 flat <td> cells appended to the loadStatus row,
AND duplicated again as 5 separate <tr> rows in the outer table.
On the published page, the nested-table rows were leaking out of
the loadStatus Description cell and rendering as outer-table rows
between loadStatus and id.
3. The body cells were marked up with one cell per three lines of
source, making the 606-line file mostly whitespace.
Rebuilt the table as a clean 5-column, 3-row HTML table (Field /
Type / Default / Access Permission / Description) with the nested
Value/Meaning table properly contained inside the loadStatus
Description cell using <thead>/<tbody> and scope="col" headers. The
file goes from 606 lines to 106 lines with no rendered content lost.
…d anchors Three cleanup concerns in one table: 1. JSX-flavored <Table> / </Table> tags (capital T) converted to plain <table> / </table>. The capitalized form is a leftover from v1->v2 migration and not used elsewhere in the v2 docs. 2. Four <Anchor label="..." title="..." href="..."> elements converted to markdown link syntax: [text](doc:ifdeviceinfo#anchor). One had a full-URL href pointing at the v1 developer.roku.com site, normalized to the same doc:ifdeviceinfo slug as the others. 3. Three bare method references on the audioCodecCapabilityChanged and videoCodecCapabilityChanged rows had dangling text from partial anchor removal (e.g. `[CanDecodeAudio](doc:ifdeviceinfo) asObject)` with `asObject)` outside the link). Rewrote those as `[CanDecodeAudio(audio_format as Object)](doc:ifdeviceinfo# candecodeaudioaudio_format-as-object-as-object)` and similar, so the link text shows the method signature and the anchor lands on the specific method definition. Also added scope="col" on header cells, collapsed each body cell from three source lines to one (except generalMemoryLevel which keeps its <ul>), and removed the stray blank line between rows inside <tbody> (broke GitHub/IDE preview rendering even though ReadMe tolerated it).
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
Follow-up to the May 11 ArrayGrid table fix (
9476417c). That commit fixed a single page where a JSX-style<Table>with 13 declared columns and 8 trailing empty<th></th>cells was rendering 8 phantom blank columns on the live site. This PR adds a docs-lint rule to catch the same class of bug repo-wide, and fixes the 4 other files it surfaced.Commits
docs-lint: add empty-table-header-cell + html-row-cell-count-mismatch rules— two new error-severity rules intables.mjs. Conservative exceptions: row-header tables (using<th scope="row">) are exempt from the empty-th check; tables with nested<table>orrowspan/colspan > 1are exempt from the cell-count check.media/index.md: use scope=row for comparison-table row labels— Adaptive streaming protocols and Supported video codecs tables converted to proper row-header markup with<th scope="row">andscope="col". Improves accessibility (screen readers now read row + column context) and matches the styling ReadMe applies to row headers.brs-profiler-file-format.md: label entry-type column, drop empty <th>— 8 binary-format tables had an empty header for the entry-type-bits column. Labeled them "Entry type" (and "Operation type" for the additional column in the Memory operation table).componentlibrary.md: rebuild Fields table, drop phantom columns— Same JSX-<Table>+ 10-empty-<th>bug as ArrayGrid, plus a nested Value/Meaning table that was duplicated 3 ways and rendering its rows outside the loadStatus Description cell. File goes from 606 lines to 106 with no content lost.rodeviceinfoevent.md: convert JSX Table/Anchor to markdown, add method anchors— Capital<Table>to lowercase<table>, 4 JSX<Anchor>elements converted to markdown links withdoc:ifdeviceinfo#…slugs, 3 dangling-link-text bugs ([X](doc:y)asObject)) repaired to use proper method-signature link text + specific method anchors.