Skip to content

Commit

Permalink
fix(action): create localized template for aria-label #9071
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Sep 19, 2024
1 parent 4160af1 commit 2afd383
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions packages/calcite-components/src/components/action/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,7 @@ export class Action
buttonId,
messages,
} = this;
const labelFallback = label || text;
const ariaLabel = labelFallback
? `${labelFallback}${indicator ? ` (${messages.indicator})` : ""}`
: "";
const ariaLabel = messages.indicatorLabel?.replace("{label}", label || text) ?? "";

const buttonClasses = {
[CSS.button]: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"loading": "Loading",
"indicator": "Indicator present"
"indicator": "Indicator present",
"indicatorLabel": "{text} (Indicator present)"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"loading": "Loading",
"indicator": "Indicator present"
"indicator": "Indicator present",
"indicatorLabel": "{text} (Indicator present)"
}

0 comments on commit 2afd383

Please sign in to comment.