Skip to content

fix(Table): a column resize handle announces the column's rendered width - #10593

Merged
cixzhang merged 14 commits into
mainfrom
fix/table-resize-rendered-width
Nov 9, 2026
Merged

cixzhang merged 14 commits into
mainfrom
fix/table-resize-rendered-width

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Who this helps

Screen-reader users resizing Table columns. Until a column was first resized, its resize handle announced the column's minimum width as its value: in Chromium's accessibility tree on main, a 200px column read as 60 (spec:AST-020 FR1).

Stacked on #10577 (the handle's range); review that first.

What changed

  • Rendered width: the handle announces its column's rendered width in whole pixels, from the first measurement after layout, and follows the column as it is resized.
  • INV18: the width comes from the shared resize observer on the column's header cell (borderBoxSize, or one read in the observer's first call). Render never reads layout.
  • Fallback: until the first measurement, the value is the width the table asked for, else the column's minimum, as before.
  • Record: component:useTableColumnResize gains AR8 and a verification row.

Changeset: [fix] patch for Core.

Verification

  • Real Chrome (local Storybook builds of main 209e067 and this branch, Core/TableColumnResize Default story, read from Chromium's accessibility tree over CDP):

    State Rendered widths main This PR
    Before any resize 200, 200 60, 60 200, 200 ("200 pixels")
    After 3 × ArrowRight on the first column 230, 170 100, 100 230, 170
  • Tests:

  • Other checks: lint, knowledge, and the prepush typecheck.

Writing rubric results

Covers component:useTableColumnResize AR8 and its verification row.

R1 narration: none; the line states what the handle announces.
R2 research: none in the record; the measurements are here.
R3 evidence: the verification cell names tests, not pull requests.
R4 rejected alternatives: none recorded.

…t holds its width

A column-resize separator on a column with no maximum width rendered no
aria-valuemax, so assistive technology assumed ARIA's default of 100 and read
the width past it. Such a handle now announces the window's inline extent as
its maximum, floored at its value and minimum, as an unbounded Resizable
region does, and its width in words ("133 pixels"), since that maximum stands
in for a missing limit. The server render carries no maximum until
hydration reads the window. A column with maxWidth is unchanged. Record:
useTableColumnResize AR7 and its verification row. Adds the
@astryx.table.columnResize.widthValue catalog string.
Until a column was first resized, its handle's aria-valuenow was the
column's minimum width, so a screen reader read a 200px column as 60px.
The handle now reads its column's width from the shared resize observer
after layout (never in render) and announces it, following the column as
it is resized; until the first measurement it falls back to the width the
table asked for, then the minimum. Record: useTableColumnResize AR8 and its
verification row; a jsdom case and a Chromium accessibility-tree case.
@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 9, 2026 6:43am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 7, 2026
@astracat-bot

astracat-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 9, 2026, 7:39 AM UTC

@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec c88e1cf

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: unbounded columns now announce their real width (200 instead of 60 in the Default story), but three things need fixing first.

  • A column rendered wider than maxWidth, or narrower than a global minWidth, now gets an aria-valuenow outside its aria-valuemin/aria-valuemax, and Chromium then announces the limit instead (300 for a 416px column with min 80 and max 300), so keep the announced range holding the value, or say in AR8 what such a column announces, and add a test with maxWidth below the rendered width.
  • The changeset says the handle "now announces its column's rendered width", which does not hold for bounded columns until the first point is fixed, so fix that or narrow the wording to columns within their limits.
  • The new mount-only useEffect in ResizeHandle does only attach-time work, so move it to a stable callback ref on the separator that subscribes the header cell with observeResize and returns the unsubscribe, and drop handleRef.

Non-blocking: the comment above valueNow is one 31-word sentence; two shorter sentences would keep it under the 25-word limit.

[Automated review]

Comment on lines +806 to +808
// A focusable role="separator" requires a numeric aria-valuenow, so it
// falls back to the width the table asked for, then to the column's
// minWidth, until the column has been measured.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: one 31-word sentence, over the 25-word limit for a description. Suggested: "A focusable separator needs a numeric aria-valuenow. Until the column is measured, it uses the requested width, else minWidth."

Addresses review on the separator range:
- The window width every unbounded handle announces comes from one shared
  store in utils/windowExtent.ts, with one resize listener and a stable
  snapshot, so render and commit read no layout (INV18). Resizable's
  stand-in maximum calls the same readWindowExtent and standInMaximum, so
  the two share one rule; its behavior is unchanged.
- The value text is plural-aware: "{width, number} {width, plural, one
  {pixel} other {pixels}}".
- Record: AR1 points at AR7 for the value bounds; Compatibility records the
  changed announced range; AR7 says the handle announces its value in words
  and names the known gap (the value is the minimum until a first resize).
  The changeset says the same.
…-rendered-width

Takes #10577's review round (shared window-width store, plural value text,
AR1/AR7 record). AR7 drops its known-gap sentence: AR8 closes it.
@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 0944bd4

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: unbounded and in-limit columns now announce their real width (200 instead of 60 in the Default story), but the three fixes from the previous review are still needed.

  • A column rendered wider than maxWidth, or narrower than a global minWidth, gets an aria-valuenow outside its aria-valuemin/aria-valuemax (useTableColumnResize.tsx:811), so Chromium announces 300 for a 416px column under maxWidth: 300; keep the range holding the value, or have AR7 and AR8 say what such a column announces, and add a bounded test case.
  • The changeset (.changeset/table-resize-rendered-width.md:5) promises every handle announces its column's rendered width, which bounded columns do not get until the first fix lands, so fix that or narrow the wording.
  • The mount-only Effect at useTableColumnResize.tsx:429-442 only subscribes the header cell when the handle attaches, which is a ref's job under react-component-runtime INV6: use a stable callback ref on the separator (:827) that returns the unsubscribe, and drop handleRef.

When you edit the record, also name AR8's value change in its compatibility bullet, and give the "after keyboard resizes" state in the AR8 verification row an arrow-key step in the Chromium case.

[Automated review]

… text

- The window-width store is fed by the shared resize observer on the root
  element and reads innerWidth inside its report, so no resize event reads
  layout (INV18). The snapshot stays stable.
- The value text says a whole number of pixels: a 202.656 px column reads
  "203 pixels". Tests: no window resize listener, and the fractional case.
…vation

- A column the layout renders past its maxWidth, or under its minWidth,
  announces a range widened to hold the width it reports: aria-valuemax is
  at least the value, aria-valuemin at most. Test: a 180 px column under
  maxWidth 150 (fails on the previous head, where max stayed 150).
- The header cell's resize observation lives in a stable callback ref on
  the separator that returns its unsubscribe, not a mount-only Effect.
- Record: AR7 says what a column rendered past its limits announces; the
  compatibility bullet names AR8's value change; the AR8 verification row
  gives the Chromium case two ArrowRight presses, which the spec now runs.
- The changeset covers the bounded case.
…laces

This stack ships both changesets; the rendered-width fix here makes the
separator-range note's "until a column is first resized, that value is
still its minimum width" untrue, so it goes.
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec c500071

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet (the pull request is a draft against the stacked branch), so it is not ready to merge, and it lands after #10577.

Every resizable column's handle now announces its rendered width inside a range that holds it, and the three changes from the previous review are in: a column stretched past maxWidth or squeezed under its minimum announces its width (416 for a 416px column under maxWidth: 300), the changeset matches that, and the header cell is observed from the separator's callback ref. The new unit and Chromium tests fail on the base and pass here.

Non-blocking suggestions:

  • Add a unit case with minWidth above the measured width: removing the Math.min clamp on aria-valuemin still passes every current test.
  • In the record, list the new minimum clause and the past-limits test in AR7's verification row.
  • Update the description's "What changed" and writing-rubric results to cover the AR7 amendment and the range widening.
  • Tighten the comments at useTableColumnResize.tsx:425-427 and :808-810 (inline).

[Automated review]

};
};
try {
render(<ResizeTable minWidth={60} maxWidth={150} />);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: with minWidth={60} and 180px cells, the aria-valuemin <= 180 assertion holds with or without Math.min(minWidth, valueNow), so removing that clamp still passes all 50 tests. Add a case with minWidth above the measured width, for example minWidth={250} with 180px cells, expecting aria-valuemin="180".

Comment on lines +425 to +427
// The column's rendered width, which the handle announces. The shared
// resize observer reports it after layout, so render never reads layout.
// The handle's ref observes its header cell while the handle is attached.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: the third sentence narrates the ref, and "reports it after layout" leaves out that the first value comes from one getBoundingClientRect read when the ref attaches. Suggested: "Render never reads layout. The shared resize observer reports the width. Its first call, at attach, reads the cell once."

main moved Resizable's warnings to per-instance createDevWarnings and made
QUIET null (#10655). This branch moves readWindowExtent to
utils/windowExtent; the merge keeps both.
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 9, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 3278cd8

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet (the pull request is a draft against the stacked branch), so it is not ready to merge, and it lands after #10577.

Every resizable column's handle announces its rendered width inside a range that holds it. The newest commit only merges the updated base branch: the new unit and Chromium tests still fail on the base and pass here, and the spec changes carry an engineering owner's approval for this head.

Non-blocking suggestions:

  • Add a unit case with minWidth above the measured width: removing the Math.min clamp on aria-valuemin still passes every current test.
  • In the record, list the new minimum clause and the past-limits test in AR7's verification row.
  • Update the description to cover the AR7 amendment and to name the record module:Table/useTableColumnResize.
  • Tighten the comments at useTableColumnResize.tsx:425-427 and :808-810 (open inline threads).

[Automated review]

@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 4ba5ee3

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because the pull request is still a draft.

Every resizable column's handle now announces its rendered width inside a range that holds it, and the record changes carry an engineering owner's approval for this head.

Before this can land:

  • Merge main into the branch. Since #10577 landed, the branch conflicts with main in five files; main holds #10577's final version of each, so keeping this branch's side leaves only this change. The merge makes a new head, which needs a fresh /approve-spec <full head SHA> from an engineering owner (the author may post it as one) and a new review.
  • Mark the pull request ready for review so CI runs.

Non-blocking suggestions:

  • Add a unit case with minWidth above the measured width: removing the Math.min clamp on aria-valuemin still passes every test.
  • List AR7's new minimum and past-maximum clauses in AR7's own verification row.
  • Update the description: drop the "Stacked on #10577" note, use the record id module:Table/useTableColumnResize, and mention the AR7 amendment.

[Automated review]

The base branch merged as one squash commit, so this merge takes main's
tree and reapplies only this change's own diff on top of it.
@cixzhang
cixzhang changed the base branch from fix/table-resize-separator-range to main November 9, 2026 05:16
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e715473

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
TableBody 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
TableFooter 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
TableHeader 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
5 more components
Component Size LoC Visual · A11y · RTL
TableRow 7.0 kB (0) · 4.0 kB CSS (0) — ✓ · ✓ · ✗
Table 124.9 kB (0) · 18.3 kB CSS (0) — ✓ · ✓ · —
TableCell 109.6 kB (0) · 17.9 kB CSS (0) — ✓ · ✓ · ✓
TableHeaderCell 109.2 kB (0) · 17.7 kB CSS (0) — ✓ · ✓ · ✓
TableSelectionToolbar 70.7 kB (0) · 13.2 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 7.20 MB packed (+507 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 34 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. Every resizable column's handle now announces the column's rendered width from the first layout (200 instead of 60 in the Default story), and its range widens to hold a column the layout renders past its limits. The new unit test and Chromium spec fail on main and pass here, and the record's AR8 and amended AR7 carry an engineering owner's spec approval for this text.

Non-blocking:

  • Removing the Math.min clamp at useTableColumnResize.tsx:823 still passes every test; a case with minWidth={250} and 180px cells, expecting aria-valuemin="180", would guard it.
  • AR7's verification row could name the new minimum and past-maximum clauses and their tests.
  • The description still asks reviewers to review #10577 first, names the record component:useTableColumnResize instead of module:Table/useTableColumnResize, and its main column predates #10577.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 07:16
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec e715473

@cixzhang
cixzhang merged commit 1785da1 into main Nov 9, 2026
189 checks passed
@github-actions
github-actions Bot deleted the fix/table-resize-rendered-width branch November 10, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — e7154735 Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant