Skip to content

fix(markdown): forward the rest of BaseProps on Markdown and List - #5288

Merged
cixzhang merged 3 commits into
meta:mainfrom
lexs:md-dom-align-delimiter
Aug 26, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
lexs:md-dom-align-delimiter

Conversation

@lexs

@lexs lexs commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Split per review: this PR is now only the prop forwarding, rebased onto current main.

Markdown and List both declare BaseProps, and BaseProps documents that data-*, aria-* and role reach the element — but each destructured a fixed set of props and forwarded only data-testid. So <Markdown aria-label="Release notes"> named nothing, and a list could not be labelled by a heading it did not render itself.

Consumer props spread first, so what a component sets for itself still wins: the block root stays role="document", the list keeps the explicit role="list" that restores Safari/VoiceOver announcements, and a list rendering its own header keeps that association. That aria-labelledby is now written only when the header exists — writing undefined unconditionally erased a label a consumer pointed at their own heading.

data-align and data-delimiter are gone from this PR. Detail in the review thread, but briefly: the introspection need behind them is now served by parseMarkdown(src, {sourceRanges: true}) (#5290), and the rendering half you identified is a separate fix.

Tests: forwarding, and that a consumer prop cannot displace the role or the header association, on both components and on the inline root.

@vercel

vercel Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Error Error Aug 26, 2026 5:37pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 21, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Aug 21, 2026
@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

List (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 282 -
Complexity N/A High (23) -
Markdown (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3095 -
Complexity N/A Very High (205) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 4 compared shot(s). 50 shot(s) have no baseline yet and were not compared.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 21, 2026

@cixzhang cixzhang 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.

Thanks — and the two halves of this land differently, so taking them separately.

The prop forwarding is right and I'd take it today. BaseProps has declared data-*, aria-* and role as passthrough all along, and List and Markdown were quietly dropping them — so <Markdown aria-label="Release notes"> reached nothing. That's a real accessibility bug on two shipped components, and your fix matches what TableCell already does, consumer props first so the component's own attributes still win.

data-align and data-delimiter I'd like to hold. Not because of the code — because a consumer is meant to read them, and that read has no type, no declaration and no drift guard. BaseProps also lets a consumer pass any data-* of their own, so the component and the caller would be writing into one shared namespace with nothing partitioning it. And it's the same question you raised on #5290 and deliberately left to us — escapes, fence characters and heading depth all want the same answer, so it's worth settling once rather than four times.

Would you split them? The forwarding fix can merge on its own, and the attributes can follow whichever shape we pick.

If you'd rather talk it through with someone, we're in Discord.

[Reviewed by Robohands]

@cixzhang

Copy link
Copy Markdown
Contributor

Following up on my own comment — I think there's a real bug underneath this, and it's better than the attribute.

cellAlignStyles (Markdown.tsx:238) only defines center and end. There is no start, so an explicitly left-aligned column — | :--- | — gets no style at all and renders identically to | --- |. In LTR that looks correct by accident, because the default is already start. In RTL it is wrong: the author wrote :--- to mean left, and the cell inherits start, which is right.

So the parser reads the alignment and the renderer drops one third of it. That's the thing to fix — add the start case and apply it, the same way center and end already are. data-align doesn't render anything; it hands the alignment to a consumer to apply, when the component should be applying it itself.

Same shape for data-delimiter, worth checking: an <ol> written 1) renders as 1. today. If the delimiter is meant to survive, that's list-style-type on the element, not an attribute describing what we chose not to do.

Sorry for the two-step. The forwarding fix still stands on its own and I'd take it today.

[Reviewed by Robohands]

@cixzhang cixzhang 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.

Sorry for the back and forth — reading this again, I think there are two different problems here and it's worth naming which one we're solving.

Is this about rendering, or about introspection?

If it's rendering, it isn't fixed here. cellAlignStyles (Markdown.tsx:238) has only center and end — no start — so | :--- | gets no style and renders identically to | --- |. That looks fine in LTR by accident, since the default is already start, but in RTL an explicitly left-aligned column renders right. That's a real bug with a real reader, and the fix is applying the alignment, not describing it. Same question for the delimiter: an <ol> written 1) renders 1. today.

If it's introspection — reading the source back out of the DOM — I don't think that belongs in Markdown's contract as an undisclosed default. Every consumer who selects on it freezes it, and nothing declares it or guards it against drift. components already hands renderers what they need at render time, typed; heading gets a generated id for exactly this reason. It has no table/tableCell/list entry yet, and extending it looks closer to what you want.

The prop forwarding is unaffected by any of this and I'd take it today — BaseProps has promised aria-* passthrough all along and both components were dropping it. Happy to merge that on its own if you split it out.

Which problem were you solving? If both, they probably want to be two PRs.

If you'd rather talk it through with someone, we're in Discord.

[Reviewed by Robohands]

Comment thread packages/core/src/Markdown/Markdown.tsx Outdated
<TableHeaderCell
// eslint-disable-next-line @eslint-react/no-array-index-key -- markdown table columns are positional by definition
key={i}
data-align={node.alignments[i] ?? undefined}

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.

This is where the alignment should be applied, not described — cellAlignStyles has no start case, so an explicit :--- column renders like an undeclared one (wrong in RTL).

Both declare BaseProps, and BaseProps documents that data-*, aria-* and role
reach the element — but each destructured a fixed set of props and forwarded
only data-testid, so an aria-label a consumer passed silently disappeared.

Consumer props spread first, so what a component sets for itself still wins:
the block root stays role="document", the list keeps the explicit role="list"
that restores Safari/VoiceOver announcements, and a list rendering its own
header keeps that association. That aria-labelledby is now written only when
the header exists — writing undefined unconditionally erased a label a
consumer pointed at their own heading.
@lexs
lexs force-pushed the md-dom-align-delimiter branch from 88e6568 to 60a49d3 Compare August 24, 2026 21:49
@lexs lexs changed the title feat(markdown): expose table alignment and list delimiter in the DOM fix(markdown): forward the rest of BaseProps on Markdown and List Aug 24, 2026
@github-actions
github-actions Bot requested a review from cixzhang August 24, 2026 21:49
@lexs

lexs commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Both, and you were right that they are two problems — split.

This PR is now the forwarding fix only, rebased onto current main. data-align and data-delimiter are gone from it.

The rendering half is #5444. Applying the alignment, as you said, rather than describing it: :--- renders left and ---: renders right, both physical, so an explicitly left-aligned column stops landing on the right in RTL. That also moves ---: off the logical end it was on — the same bug seen from the other side — which is the one behaviour change worth your eye.

On the delimiter, you are right that it is a rendering gap too, and it is a real one here. An HTML <ol> cannot express 1), but Astryx does not use one: ListItem draws the marker itself, content: counter(astryx-list) "." hard-coded. So a list authored 1) renders 1. and the design system is the thing that decided that. Fixing it means a delimiter on List reaching the marker style — a public prop, not just a Markdown change — so I left it out of #5444 rather than bundle an API addition into a bug fix. Happy to open it if you want it.

On the introspection question — you can drop it. parseMarkdown(src, {sourceRanges: true}) (#5290, shipped in 0.5.0) turned out to answer it better than any attribute would: a consumer holding the source slices the block verbatim, so escapes, fence characters, heading depth beyond the clamp and alignment all survive without anything being read back out of the DOM. That is the shape our own consumer is now being rewritten onto. So there is no undisclosed contract to freeze, and no fourth round of the same question.

@cixzhang cixzhang 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.

Thanks — this is the split we asked for, and the forwarding half is clean. Clearing my changes-requested and taking it.

[Reviewed by Robohands]

@cixzhang cixzhang 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.

Re-approving after the branch update; the reviewed diff is unchanged.

[Reviewed by Robohands]

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Aug 26, 2026

@cixzhang cixzhang 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.

Re-approving after the empty CI-retrigger commit; the reviewed diff is unchanged.

[Reviewed by Robohands]

gonzoblasco added a commit to gonzoblasco/astryx that referenced this pull request Aug 26, 2026
…ia props

When TreeList renders a visible header, that generated header id should
keep naming the tree, so assistive tech hears the same name the user
sees. An external aria-labelledby now only applies on the headerless
path, and a caller aria-label is ignored when a header names the tree.
Matches the precedence meta#5288 applies to List.
@cixzhang
cixzhang merged commit 43a0839 into meta:main Aug 26, 2026
22 of 23 checks passed
cixzhang pushed a commit that referenced this pull request Aug 26, 2026
… (#5493)

* fix(TreeList): forward BaseProps attributes to the tree element (#5476)

TreeList destructured a fixed set of props with no rest spread, so every
BaseProps attribute (aria-*, role, tabIndex, id, event handlers) was
dropped and never reached the DOM. A tree without a visible header could
not be named at all - a screen reader announced an unnamed tree with no
way to know which tree it was.

The component now spreads the remaining props onto the root element and
routes aria-label/aria-labelledby onto the <ul role="tree"> itself, so
<TreeList aria-label="File tree"> names the tree. A consumer-supplied
aria-labelledby wins over the internal header association, and the
contract role="tree" is written after the rest spread so a consumer
cannot displace it. Adds regression tests asserting aria-label reaches
the tree element and id reaches the root.

* fix(TreeList): keep the visible header naming the tree over caller aria props

When TreeList renders a visible header, that generated header id should
keep naming the tree, so assistive tech hears the same name the user
sees. An external aria-labelledby now only applies on the headerless
path, and a caller aria-label is ignored when a header names the tree.
Matches the precedence #5288 applies to List.
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element each ref targets, composing consumer handlers
in front of component-owned ones with composeEventHandlers (RadioList
onFocus; TimeInput onFocus/onBlur/onKeyDown). Same class and same fix
shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six were not in
that issue's tarball-derived list. PowerSearch shares the shape and is
deliberately left out - its forwarding target is an API decision.
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element each ref targets, composing consumer handlers
in front of component-owned ones with composeEventHandlers (RadioList
onFocus; TimeInput onFocus/onBlur/onKeyDown). Same class and same fix
shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six were not in
that issue's tarball-derived list. PowerSearch shares the shape and is
deliberately left out - its forwarding target is an API decision.
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element each ref targets, composing consumer handlers
in front of component-owned ones with composeEventHandlers (RadioList
onFocus; TimeInput onFocus/onBlur/onKeyDown). Same class and same fix
shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six were not in
that issue's tarball-derived list. PowerSearch shares the shape and is
deliberately left out - its forwarding target is an API decision.
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element that owns each component's contract, spread
first so owned attributes win. Where the component owns the same event,
handlers compose component-first with composeEventHandlers so owned
behavior (focus normalization, arrow stepping, blur reconciliation) is
uncancellable (RadioList onFocus; TimeInput onFocus/onBlur/onKeyDown on
both its typed and native-picker paths). A caller id is honored via
id ?? generatedId per the Selector precedent, and caller aria-labelledby
and aria-describedby compose additively with the owned ids. Same class
and same fix shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six
were not in that issue's tarball-derived list. PowerSearch and
MultiSelector share the shape and are deliberately left out - their
forwarding is an API decision and a Selector-precedent follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element that owns each component's contract, spread
first so owned attributes win. Where the component owns the same event,
handlers compose component-first with composeEventHandlers so owned
behavior (focus normalization, arrow stepping, blur reconciliation) is
uncancellable (RadioList onFocus; TimeInput onFocus/onBlur/onKeyDown on
both its typed and native-picker paths). A caller id is honored via
id ?? generatedId per the Selector precedent, and caller aria-labelledby
and aria-describedby compose additively with the owned ids. Same class
and same fix shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six
were not in that issue's tarball-derived list. PowerSearch and
MultiSelector share the shape and are deliberately left out - their
forwarding is an API decision and a Selector-precedent follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element that owns each component's contract, spread
first so owned attributes win. Where the component owns the same event,
handlers compose component-first with composeEventHandlers so owned
behavior (focus normalization, arrow stepping, blur reconciliation) is
uncancellable (RadioList onFocus; TimeInput onFocus/onBlur/onKeyDown on
both its typed and native-picker paths). A caller id is honored via
id ?? generatedId per the Selector precedent, and caller aria-labelledby
and aria-describedby compose additively with the owned ids. Same class
and same fix shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six
were not in that issue's tarball-derived list. PowerSearch and
MultiSelector share the shape and are deliberately left out - their
forwarding is an API decision and a Selector-precedent follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>
harjothkhara added a commit to harjothkhara/astryx that referenced this pull request Sep 3, 2026
Layout, MetadataList, NavHeadingMenuItem, RadioList, TimeInput, and
TopNavMegaMenuItem declared extends BaseProps but destructured a closed
set of props with no rest spread, so aria-*, id, data-*, and event
handlers type-checked and silently never reached the DOM. Forward the
rest object to the element that owns each component's contract, spread
first so owned attributes win. Where the component owns the same event,
handlers compose component-first with composeEventHandlers so owned
behavior (focus normalization, arrow stepping, blur reconciliation) is
uncancellable (RadioList onFocus; TimeInput onFocus/onBlur/onKeyDown on
both its typed and native-picker paths). A caller id is honored via
id ?? generatedId per the Selector precedent, and caller aria-labelledby
and aria-describedby compose additively with the owned ids. Same class
and same fix shape as the meta#5254 batches (meta#5288, meta#5493, meta#5563); these six
were not in that issue's tarball-derived list. PowerSearch and
MultiSelector share the shape and are deliberately left out - their
forwarding is an API decision and a Selector-precedent follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>

This branch had an error being deployed

1 failed deployment
Preview — b1a82ac9 Deployed Aug 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants