Repository navigation
fix(markdown): forward the rest of BaseProps on Markdown and List - #5288
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsList (@astryxdesign/core) · View in Storybook
Markdown (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: 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 |
cixzhang
left a comment
There was a problem hiding this comment.
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]
|
Following up on my own comment — I think there's a real bug underneath this, and it's better than the attribute.
So the parser reads the alignment and the renderer drops one third of it. That's the thing to fix — add the Same shape for Sorry for the two-step. The forwarding fix still stands on its own and I'd take it today. [Reviewed by Robohands] |
cixzhang
left a comment
There was a problem hiding this comment.
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]
| <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} |
There was a problem hiding this comment.
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.
88e6568 to
60a49d3
Compare
|
Both, and you were right that they are two problems — split. This PR is now the forwarding fix only, rebased onto current The rendering half is #5444. Applying the alignment, as you said, rather than describing it: On the delimiter, you are right that it is a rendering gap too, and it is a real one here. An HTML On the introspection question — you can drop it. |
cixzhang
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Re-approving after the branch update; the reviewed diff is unchanged.
[Reviewed by Robohands]
cixzhang
left a comment
There was a problem hiding this comment.
Re-approving after the empty CI-retrigger commit; the reviewed diff is unchanged.
[Reviewed by Robohands]
…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.
… (#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.
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.
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.
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.
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]>
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]>
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]>
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]>
Split per review: this PR is now only the prop forwarding, rebased onto current
main.MarkdownandListboth declareBaseProps, andBasePropsdocuments thatdata-*,aria-*androlereach the element — but each destructured a fixed set of props and forwarded onlydata-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 explicitrole="list"that restores Safari/VoiceOver announcements, and a list rendering its own header keeps that association. Thataria-labelledbyis now written only when the header exists — writingundefinedunconditionally erased a label a consumer pointed at their own heading.data-alignanddata-delimiterare gone from this PR. Detail in the review thread, but briefly: the introspection need behind them is now served byparseMarkdown(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.