Skip to content

Commit 6e435c5

Browse files
committed
Fixes aria-label for action-items
1 parent 27d93d2 commit 6e435c5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/webviews/apps/shared/components/actions/action-item.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class ActionItem extends LitElement {
8787
return this.icon;
8888
}
8989

90-
get effectiveLabel(): string | undefined {
90+
get effectiveTooltip(): string | undefined {
9191
if (!this.label && !this.altLabel) {
9292
return undefined;
9393
}
@@ -100,6 +100,16 @@ export class ActionItem extends LitElement {
100100
return this.label;
101101
}
102102

103+
get effectiveLabel(): string | undefined {
104+
if (!this.label && !this.altLabel) {
105+
return undefined;
106+
}
107+
if (this.altLabel && this.isAltKeyPressed) {
108+
return this.altLabel;
109+
}
110+
return this.label;
111+
}
112+
103113
get effectiveHref(): string | undefined {
104114
if (this.isAltKeyPressed && this.altHref) {
105115
return this.altHref;
@@ -130,11 +140,11 @@ export class ActionItem extends LitElement {
130140

131141
override render(): unknown {
132142
return html`
133-
<gl-tooltip hoist content="${this.effectiveLabel ?? nothing}">
143+
<gl-tooltip hoist content="${this.effectiveTooltip ?? nothing}">
134144
<a
135145
role="${!this.effectiveHref ? 'button' : nothing}"
136146
type="${!this.effectiveHref ? 'button' : nothing}"
137-
aria-label="${this.label ?? nothing}"
147+
aria-label="${this.effectiveLabel ?? nothing}"
138148
?disabled=${this.disabled}
139149
href=${this.effectiveHref ?? nothing}
140150
>

0 commit comments

Comments
 (0)