Skip to content

Manage aria attributes and role for dialog components (CMEM-7690) - #430

Open
haschek wants to merge 11 commits into
developfrom
feature/dialogAriaRoles-CMEM-7690
Open

haschek wants to merge 11 commits into
developfrom
feature/dialogAriaRoles-CMEM-7690

Conversation

@haschek

@haschek haschek commented Sep 16, 2026

Copy link
Copy Markdown
Member

No description provided.

canOutsideClickClose={canOutsideClickClose || !preventSimpleClosing}
canEscapeKeyClose={canEscapeKeyClose || !preventSimpleClosing}
size={displayFullscreen ? "fullscreen" : size}
role={role ?? (hasSemanticIntent ? "alertdialog" : "dialog")}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended that intents like "info" map to a role of "alertdialog"?

};

// always remove the role if there is no explanation
const modalRole = ariaLabel || ariaLabelledby || ariaDescribedby ? role : undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here ariaDescribedby is enough to keep the role, but a label is required.

size={displayFullscreen ? "fullscreen" : size}
role={role ?? (hasSemanticIntent ? "alertdialog" : "dialog")}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby ?? (title ? `title_${dialogUniqueId}` : undefined)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a title is given, also specifying aria-label does nothing, which might be unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants