a11y(2.4.6): guard DrawerContent against empty <h2> when title is omitted#3595
Merged
Conversation
…tted
DrawerContent always rendered <h2>{title}</h2> even when title was '' (the
default), producing an empty heading that fails WCAG 2.4.6 (Headings and
Labels, AA) and 4.1.2 (Name, Role, Value).
Wrap the title-wrapper div in {#if title || $$slots['subtitle']} and the <h2>
in {#if title} so the element is only emitted when content exists. The
subtitle slot continues to render independently. Consumers that pass title=
are unaffected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR #3595 references A11y-Audit-Ref: 2.4.6-cloud-drawer-content-empty-title, but the slug was absent from scripts/a11y/manifest.yml, so the A11y PR Triage Action flagged it a11y:broken-ref. Add the entry so the ref resolves. Scope is universal: the fix lives in the shared Holocene DrawerContent component in ui, but the empty <h2> only surfaces via cloud consumers that omit the title prop. Bucket 2 / moderate matches the sibling 2.4.6 datepicker-empty-label entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… in Storybook The prior fix removed the .title-wrapper entirely when a drawer has neither a title nor a subtitle. That wrapper's p-6 was the only source of top padding, so title-less/subtitle-less drawers rendered flush against the top edge (both live cloud consumers, connect-drawer and add-replica, hit this path). Derive `hasHeader` and apply pt-6 to .content only when no header renders, so titled/subtitled drawers keep identical layout while the header-less case keeps its top padding. Makes DrawerContent self-contained regardless of which props a consumer passes. Add Storybook stories for the previously uncovered permutations: With Subtitle, Subtitle Only, and No Title or Subtitle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Follow-ups pushed since the original diff:
|
ardiewen
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DrawerContentdefaultedtitleto''and unconditionally rendered<h2>{title}</h2>. When a consumer omitted the prop (two cloud consumers do), the DOM contained an empty heading — no accessible name, failing WCAG 2.4.6 (Headings and Labels, AA) and 4.1.2 (Name, Role, Value).Fix: wrap the
title-wrapperdiv in{#if title || $$slots['subtitle']}and the<h2>in{#if title}. The element is only emitted when content exists; the subtitle slot continues to render independently.What changes
Impact
title=(all 9 existing correct usages): no change in rendered output.title(the two cloud gaps): empty<h2>removed.Test plan
<h2>still renders with correct text.<h2>.References
audit-output/issues/2.4.6-cloud-drawer-content-empty-title.mdA11y-Audit-Ref: 2.4.6-cloud-drawer-content-empty-title
🤖 Generated with Claude Code