fix(a11y)-3: prevent rendering empty dialog title headings#4397
fix(a11y)-3: prevent rendering empty dialog title headings#4397illume merged 1 commit intokubernetes-sigs:mainfrom
Conversation
Signed-off-by: Sagar Choudhary <sagar6203620715@gmail.com>
07d4702 to
0ec1615
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes accessibility violations by preventing the DialogTitle component from rendering empty <h1> heading elements when no title content is provided. This addresses 11 empty heading violations identified by axe-storybook-testing across various dialog components (AuthToken, AuthChooser, and Chooser stories).
Changes:
- Added early return in
DialogTitlewhen both children and action buttons are absent to avoid rendering the component entirely - Conditionally render the title content Grid item only when children exist to prevent empty
<h1>elements - Preserved rendering of dialog action buttons when present, ensuring fullscreen and close buttons still appear
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: illume, Sagar-6203620715 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
This PR fixes accessibility violations by preventing
DialogTitlefrom rendering empty heading elements when no title content is provided.Related Issue
Addresses point 3 from the accessibility issue
Changes
DialogTitleto returnnullwhen bothchildrenand action buttons are absentSteps to Test
Screenshots (if applicable)
N/A
Notes for the Reviewer
Dialog.tsx; no story files were modified