Skip to content

Commit 776684d

Browse files
authored
Merge pull request desktop#16133 from desktop/Misattributed-Commit-Button-Description
Give Misattributed Warning Avatar button a label
2 parents 8a49898 + d941c53 commit 776684d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/src/ui/changes/commit-message-avatar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export class CommitMessageAvatar extends React.Component<
7272
return (
7373
<div className="commit-message-avatar-component">
7474
{this.props.warningBadgeVisible && (
75-
<Button className="avatar-button" onClick={this.onAvatarClick}>
75+
<Button
76+
className="avatar-button"
77+
ariaLabel="Commit may be misattributed. View warning."
78+
onClick={this.onAvatarClick}
79+
>
7680
{this.renderWarningBadge()}
7781
<Avatar user={this.props.user} title={this.props.title} />
7882
</Button>

app/src/ui/lib/button.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export interface IButtonProps {
7777
readonly role?: string
7878
readonly ariaExpanded?: boolean
7979

80+
/**
81+
* Typically the contents of a button serve the purpose of describing the
82+
* buttons use. However, ariaLabel can be used if the contents do not suffice.
83+
* Such as when a button wraps an image and there is no text.
84+
*/
85+
readonly ariaLabel?: string
86+
8087
/**
8188
* Whether to only show the tooltip when the tooltip target overflows its
8289
* bounds. Typically this is used in conjunction with an ellipsis CSS ruleset.
@@ -134,6 +141,7 @@ export class Button extends React.Component<IButtonProps, {}> {
134141
role={this.props.role}
135142
aria-expanded={this.props.ariaExpanded}
136143
aria-disabled={disabled ? 'true' : undefined}
144+
aria-label={this.props.ariaLabel}
137145
>
138146
{tooltip && (
139147
<Tooltip

0 commit comments

Comments
 (0)