Repository navigation
fix(Avatar): no public data-initials attribute; the initials come from a private StyleX dynamic style - #10944
Conversation
…ith no public data-initials attribute A StyleX dynamic style sets the quoted initials as a hashed inline custom property. The ::before draws it plainly, and as '<initials> / ""' (empty alternative text) where @supports allows, so the initials stay out of the accessible name. The Label in Name spec runs in WebKit too.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 5dc5130 |
|
/approve-spec f9ab850 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/Comments | 352.2 kB (+133 B) · 2.5 kB CSS (0) | — | — · — · — |
| Avatar | 43.5 kB (+106 B) · 5.6 kB CSS (+26 B) | — | ✓ · ✓ · ✓ |
| AvatarGroup | 46.2 kB (+95 B) · 5.7 kB CSS (+26 B) | — | — · — · — |
6 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 288.5 kB (+86 B) · 24.2 kB CSS (+29 B) | — | — · — · — |
| lab/CommentComposer | 152.3 kB (+115 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 345.3 kB (+100 B) · 2.4 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 49.1 kB (+72 B) · 5.7 kB CSS (+26 B) | — | — · — · — |
| lab/CommentPin · Storybook | 57.4 kB (+95 B) · 1.2 kB CSS (0) | 413 (0) | — · ✓ · — |
| AvatarStatusDot | 7.5 kB (0) · 3.5 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 7.23 MB packed (+376 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 36 rows; 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
There was a problem hiding this comment.
Changes requested: the Avatar change itself holds up, but it leaves the release notes contradicting each other.
.changeset/avatar-initials-label-in-name.mdstill tells consumers that tests read thedata-initialsattribute, while the new.changeset/avatar-initials-private-content.mdsays that attribute is gone; neither has shipped, so both land in the same changelog — please drop or replace that last sentence of the earlier changeset and delete or reword the new one so the notes describe only the change since the last release.
The initials render pixel-identically to main, and the new tests, the server-render test and a Chromium and WebKit check of the accessible names all pass. Two optional points: the new comment above dynamicStyles.initials would read better as short sentences, and the description says CI runs the Label in Name spec in WebKit, but the workflows run it in Chromium only.
[Automated review]
|
/approve-spec 21774da |
There was a problem hiding this comment.
Approved. Avatar no longer writes the unreleased data-initials attribute, the initials draw exactly as before, and the release notes now agree with each other.
One optional fix: the description says CI runs the Label in Name spec in Chromium and WebKit, but CI's accessibility job runs it in Chromium only, so WebKit covers it only when run locally.
[Automated review]
failingSpecs no longer waits after its fourth and last try, so a log that keeps answering 5xx gives up after 30 s of waits, and a test pins four server errors in a row. This also corrects the earlier commit's wording: the three pull requests that now replay a narrow selection (#9672, #10271, #10944) are ones whose story was their only full-suite trigger, not ones that change only stories. Their stories are Drawer, TableSelection and Avatar; Button's specs run because those stories import Button.
… retries a server error (#11317) * ci: the selection replay record covers the story rule; a log download retries a server error The record is regenerated with the Chromium lane's story rule (#11250). Every verdict matches the earlier record: 144 no failure, 4 caught, 4 reviewed, 1 out of scope. Three pull requests that change only stories now replay a narrow selection with no failure (#9672, #10271, #10944). GitHub's job-log endpoint answers 502 now and then, so failingSpecs tries a server error again, up to four times, before it calls a log unreadable. * Merge remote-tracking branch 'origin/main' into ci/replay-story-rule * ci: a log download waits only between tries, not after the last failingSpecs no longer waits after its fourth and last try, so a log that keeps answering 5xx gives up after 30 s of waits, and a test pins four server errors in a row. This also corrects the earlier commit's wording: the three pull requests that now replay a narrow selection (#9672, #10271, #10944) are ones whose story was their only full-suite trigger, not ones that change only stories. Their stories are Drawer, TableSelection and Avatar; Button's specs run because those stories import Button.
User impact
Since the Avatar Label in Name fix, which is in no release yet, the initials were stored in a public
data-initialsattribute on the page. A public attribute becomes part of Avatar's API: callers and tests start depending on it. This change removes the attribute before the next release.What people see and hear does not change:
Problem and solution fit
The initials need to be drawn without being text of the control, so they stay out of the accessible name (WCAG 2.5.3 Label in Name). The earlier change used
content: attr(data-initials), which needs an attribute. Now a StyleX dynamic style sets the quoted initials as a hashed, per-instance inline custom property, and the::beforedraws it:content: var(--x-…)draws the plain string.@supports (content: "a" / ""),content: var(--x-…)holds"<initials>" / "", so engines that read alternative text for generated content get an empty one.No custom property is named by hand, and no caller
styleis used. The string is CSS-quoted with quotes and backslashes escaped.Older engines (Safari before 17.4, Firefox before 128) skip the
@supportsrule and draw the plain string. A link or button avatar is named by itsaria-label, which overrides content, and a static avatar isrole="img"with its name, which hides its children. In both cases a screen reader on an older engine hears only the person's name.Expected behavior and authority
component:AvatarAR1 now says: "The initials are drawn by generated content from a private per-instance CSS variable, so they stay out of the accessible name; Avatar renders no public attribute for them."Smallest restoration
Avatar.tsx: the staticattr(data-initials)rule and the attribute are gone. Theinitialsdynamic style and a smallcssStringhelper replace them.data-initialssentence, so the next changelog describes only the shipped behaviour. No second Changeset is added.Evidence
main, the Avatar and CommentPin suites fail (29 tests), including "renders no public attribute for the initials" and the rule-level check below.::before { content: var(--x-…) }rule plus an@supports (content: "a" / "")rule. The inline property holds"AL"for one and"AL" / ""for the other.AvatarLabelInName.a11y.chromium.spec.tsbecomesAvatarLabelInName.a11y.browser.spec.ts, the cross-browser naming that the local Playwright config runs in Chromium and WebKit. The CI workflows currently run it in Chromium only. It checks four things:label-content-name-mismatchis clean;data-initialsattribute is on the page.data-initialsanywhere on the page in the "Tricky names", "Interactive" and "Initials fallback" stories.::beforein light, dark and forced colors, with computedcontentsuch as"AL" / ""and"OB" / "".content: var(--x-…)rule plus a separate@supports (content: "a" / "")rule.label-content-name-mismatchhas 0 violations and 0 incomplete across light and dark in two stories.CSS.supports('content: "a" / ""')is true, and every::beforeuses the"XX" / ""form, the tricky names included. There is nodata-initials.label-content-name-mismatchhas 0 violations;CSS.supports('content: "a" / ""')is true, and::beforeuses the"XX" / ""form; nodata-initials. The accessible name was verified from the DOM; Firefox's accessibility tree was not inspected. CI covers Chromium and WebKit. Older engines fall back to the plain content and thearia-labelname.Scope
Testing
vitest run packages/core/src/Avatar packages/core/src/AvatarGroup packages/lab/src/CommentPin packages/core/src/Chat/ChatMessage.test.tsx packages/core/src/StatusDot packages/core/src/theme/themingTargets.test.ts: 717 passed.tsc, eslint,check:knowledge,check:changesets, and the comment-provenance baseline.Writing rubric results
Run over the
Avatar.spec.mdedits (one AR1 sentence, a renamed verification file).(Posted by Cindy's agent on her behalf.)