Repository navigation
audit(Blockquote): drop the contentinfo landmark, guard the cite slot, wrap long words - #5144
Conversation
<blockquote> is a sectioning root rather than sectioning content, so the
<footer> that wrapped the cite attribution mapped to a contentinfo document
landmark. Three quotes on a page produced three of them, and axe reports
landmark-no-duplicate-contentinfo and landmark-unique against Blockquote's
own footer as soon as the page carries any other landmark. The repo's own
BlockquoteTestimonials block ships three quotes. Render the <cite> directly.
Two smaller fixes in the same file: guard the slot with isRenderable, so
cite={condition && author} and cite="" stop emitting an empty <cite> element
(@astryx/no-nullish-jsx-guard already flagged the bare != null check), and
set overflow-wrap: break-word so a long unbroken word or URL wraps instead of
overflowing its own box at narrow widths.
Adds a server render test: #4407 removed 'use client' from this file and
nothing asserted that it still renders through react-dom/server.
The overview described an "accent-colored left border". The rule is drawn with --color-border-emphasized, which is a neutral border token rather than an accent, and it is a logical inline-start border that moves to the right edge in right-to-left locales. Corrected in the English, Chinese and dense docs and in the component JSDoc. Adds the pieces the doc conventions ask for and this file was missing: usage.anatomy, a second "don't", accessibility guidance in bestPractices, and playground.defaults so the playground does not open blank on a component whose children are required. Stories: adds a pull-quote story that exercises xstyle (the only documented prop no story touched), a long-content story covering wrapped quotes, long attributions and an unbroken URL, and a narrow-container story. The a11y and RTL sweeps only see what a story renders.
|
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 ComponentsBlockquote (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks — the landmark fix is right and the evidence is excellent. One nit inline: in a flex or grid row the page still scrolls sideways. Fix here, or follow up?
[Reviewed by Robohands]
| borderInlineStartColor: colorVars['--color-border-emphasized'], | ||
| paddingInlineStart: spacingVars['--spacing-4'], | ||
| color: colorVars['--color-text-secondary'], | ||
| overflowWrap: 'break-word', |
There was a problem hiding this comment.
break-word doesn't shrink a flex/grid item's min-content. Banner.tsx:260 uses anywhere for this.
| ), | ||
| }; | ||
|
|
||
| export const NarrowContainer: Story = { |
There was a problem hiding this comment.
No story puts a quote in a row, so the sweeps won't see it.
Nightly component audit of
core/Blockquoteagainst Component Audit Rubric v1.4, atb3dd679619.Pre-fix score is already in the ledger:
ed9b5538e2. The post-fix score is not recorded yet; it is held until this PR is onmain, and will be written then.Blockquote is 95 source lines with two props. Most of the rubric does not apply to it, so four sections fall under the one-third non-vacuous threshold and are marked
limitedwith their weight redistributed: a11y (3 of 19 items produce a verdict), code health (4 of 21), i18n and RTL (5 of 18), responsive (2 of 11). Sections were not padded to fill the night, and inapplicable items are N/A rather than scored as passes.What moved
limited)contentinfolandmark is gonelimited)isRenderablereplaces the bare nullish guardlimited)limited)§2 Theming 4.5, §3 API 4.5, §5a 4.5 and §5b 4.0 are unchanged.
Fixed
The attribution rendered a
contentinfodocument landmark (BLOCK, §1 A2)Blockquote.tsx:87wrapped theciteattribution in a bare<footer>.<blockquote>is a sectioning root, not sectioning content, so HTML-AAM does not scope that<footer>away: it maps to acontentinfolandmark, the "footer of the document" landmark.Measured in Chromium through CDP
Accessibility.getFullAXTree: three quotes carryingciteproduced three non-ignoredrole=contentinfonodes. On a page that also has a real footer, axe reports two violations and the node it prints is Blockquote's own<footer>:The victim is not hypothetical.
packages/cli/assets/templates/blocks/components/Blockquote/BlockquoteTestimonials.tsxships three quotes withcitein one block, and that is the code consumers copy.pnpm a11y:audit --components Blockquotewas green before this PR and is green after it. It missed this because every Blockquote story rendered a single isolated quote, so no second landmark existed for the duplicate rule to fire against. That is the §6 3/5 anchor exactly: axe green partly because the stories are too thin to reach the interesting states.Fix: render the
<cite>directly. After,Accessibility.getFullAXTreereports 0contentinfonodes, and the two axe landmark violations are gone. The rendered geometry is byte-identical: root rectx40 y40 w820 h52and cite rectx58 y72 w802 h20before and after, withmargin-block-start: 8pxon the cite unchanged, because the<footer>carried no border or padding and the cite's margin was collapsing through it.A falsy
citeemitted an empty<cite>(FIX, §7 C12)cite != nullpasses forfalse,trueand'', so the ordinary consumer shapecite={condition && author}rendered<footer><cite></cite></footer>.@astryx/no-nullish-jsx-guardalready flaggedBlockquote.tsx:86and named the remedy; the rule iswarnin both lint tiers, so nothing failed on it.Now guarded with
isRenderable. Measured after:cite={false}andcite=""both renderinnerHTMLof just the quote, with no<cite>element. Rendered height was 0 either way, so this was DOM and accessibility-tree noise rather than a visible gap.lint:strictwarnings go from 56 to 55 and Blockquote no longer appears.A long unbroken word overflowed its own box (FIX, §4 B10, §10 R1)
At a 320px viewport a 107-character word gave the blockquote
scrollWidth 813againstclientWidth 238; a long URL gave373against238. No document-level horizontal scroll, so this was cosmetic overflow rather than an unreachable control.overflow-wrapresolved tonormal, whileMarkdown,Code,ChatMessageBubbleandTooltipall setbreak-wordon their long-form text.Now
overflowWrap: 'break-word'on the root. Measured after, both cases:scrollWidth 238equalsclientWidth 238, no overflow.No server render test after #4407 (FIX, §6 V12)
#4407 dropped
'use client'from this file and nothing asserted the result. Verified with a realrenderToStringthat it does render on the server, and added that as a test rather than leaving the claim tocheck-use-client.mjs.Docs (FIX, §8 X3, X4, X10, X11, X12, X16)
--color-border-emphasized, a neutral border token measuringrgb(212,212,212)in light andrgb(82,82,82)in dark, and it is a logical inline-start border that moves to the right edge in RTL. Corrected in the English, Chinese and dense docs and in the component JSDoc.usage.anatomywas absent (X4). Added, with the three parts.<footer>.xstylewas documented but no story touched it, so prop-to-story coverage was 2 of 3 (X10). A pull-quote story now exercises it.LongContentandNarrowContainer. The a11y and RTL sweeps only see what a story renders.playground.defaultswas absent on a component whosechildrenare required, so the playground opened blank (X19). Added.Needs review
Everything below is a decision rather than a correction, so this pass did not touch it.
The attribution still sits inside the
<blockquote>. The HTML spec says attribution "must be placed outside the blockquote element", with<figure>plus<figcaption>as the worked example. The accessibility tree confirms the consequence: the blockquote subtree exposes both the quotation StaticText and "Steve Jobs". Moving to a figure changes the rendered structure and the component's theming surface, which is an API decision.citereuses a native attribute name with a different meaning (§3 P33, NIT).<blockquote cite>is natively a URL pointing at the source. Hereciteis aReactNoderendered as visible text.BasePropsextendsReact.HTMLAttributes, which never carriedcite, so there is nothing toOmitand no type collision, but there is also no way for a consumer to set the standards-correct source URL. P33's remedy is to keep the semantic name, andciteis not a semantic name distinct from the attribute, it is the attribute name. Renaming a public prop or adding one is not a fix-pass call.The attribution is a raw
<cite>rather thanText as="cite"(§2 T29). ComposingTextwould give the attribution the system's supporting-text treatment and a second theme target. It would also addastryx-textto the rendered classes, which changes the theming surface.The rule's width comes from
spacingVars['--spacing-0-5'](§2 T3, NIT). It is a token, but a spacing token used as a border width.borderVars['--border-width']exists and is 1px, and the design here wants 2px, so closing this properly means adding a border-width token, which is a system decision.Section.tsx:95uses a raw1for the same job, so the house is not consistent today either.Measure runs past 75ch. At the story's 820px width and 16px body the line is roughly 102 characters, above the §5a D6 guideline.
Textsets no measure either, so this is a system-level layout question rather than a Blockquote defect.No
play:functions in the stories (§6 V14, NIT). There is no interactive flow to exercise.Not scored against this component
defineThemecomponent overrides do not reach Blockquote. Injecting the exact CSSgenerateThemeCSSemits,@layer astryx-theme { @scope([data-astryx-theme="neutral"]) to ([data-astryx-theme]) { .astryx-blockquote { ... } } }, changes nothing:color,border-inline-start-colorandpadding-inline-startall keep their StyleX values. The identical rule with the@layerwrapper removed wins all three. The page carries two disjoint layer statements,@layer reset, astryx-base, astryx-theme, product;and@layer priority1;.That is #5095, found by last night's Banner audit and reproduced here on a structurally unrelated component. It is not a Blockquote defect and is not scored.
Token-level theming does reach the component: under the
y2ktheme the rule moves to 3px, padding to 24px, and both colours change.Evidence
Screenshots: all 26 after and 22 before captures live on the orphan branch
assets/pr-5144, underbefore/andafter/, alongside the rawmeasurements.jsonfor each pass.The landmark fix is visually a no-op. Root rect
x40 y40 w820 h52and cite rectx58 y72 w802 h20, identical before and after.Long unbroken word at 320px.
scrollWidth 813againstclientWidth 238, then238against238.Long URL at 320px.
373against238, then238against238.cite={condition && author}with the condition false. An empty<cite>in the DOM, then no element at all.RTL and the
y2kcustom theme, unchanged by this PR and captured to show they stay correct.New stories.
xstyleAlso measured, without a picture:
rgb(82,82,82)onrgb(255,255,255)is 7.81:1. Dark:rgb(163,163,163)onrgb(27,27,27)is 6.83:1. Both clear WCAG AA for body text. The decorative rule is 1.48:1 light and 2.20:1 dark, which carries no text or control requirement.dir=rtlthe rule moves to the right edge:border-left 0px,border-right 2px,padding-left 0px,padding-right 16px.pnpm rtl:audit --filter Blockquoteis 0 fail, 0 surprise.y2krenders at 3px rule, 24px padding,rgb(103,93,82)text.Checks
pnpm lint:strict: 0 errors, 55 warnings, down from 56, with no Blockquote line.pnpm test: 2 failed, 10571 passed. Both failures arepackages/clicase-insensitive-filesystem tests (component.test.mjsname resolution,hook-discovery.test.mjs) that fail identically onb3dd679619with these changes stashed. Blockquote's own suite goes from 8 tests to 12, all green.pnpm build: exit 0.pnpm a11y:audit --components Blockquote: 0 violations across all 8 stories, 0 new baseline entries.pnpm rtl:audit --filter Blockquote: 0 fail, 0 surprise.pnpm check:sync,check:changesets,check-use-client.mjs,sync-exports --check,typecheck:docs, docsitegenerateandtest: all clean.§5b is graded numerically
The judgment rows (D3, D13, D15, D16) were assessed from measured geometry, computed contrast ratios, token signatures and the resolved type scale, not by looking at the images. That caps §5b at 4 of 5, as it has been for every previous run.
Night Watch — Component Auditor