Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(action): add new string for accessible indicator label #10360

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 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,10 @@ export class Action
buttonId,
messages,
} = this;
const labelFallback = label || text;
const ariaLabel = labelFallback
? `${labelFallback}${indicator ? ` (${messages.indicator})` : ""}`
: "";
const labelFallback = label || text || "";
const ariaLabel = indicator
? messages.indicatorLabel?.replace("{label}", labelFallback)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think we can start using new message string before translations are back. This will be remove aria-label for all non-english locales.

Ex:

 <calcite-action icon="banana" scale="l" label="test" indicator text="test2" lang="bs"></calcite-action>

☝️ wouldn't add aria-label to button in shadowRoot.

Alternate: we can request a generate build which return english strings for all locales or wait until the translations are back before start using indicatorLabel string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we just add the string to the messages for now then and move this issue to another milestone? What would you recommend?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we need a better process for issues with string changes to get the strings in first. Separate the issues.

Copy link
Contributor

@anveshmekala anveshmekala Sep 20, 2024

Choose a reason for hiding this comment

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

Should we just add the string to the messages for now then and move this issue to another milestone? What would you recommend?

Yup that works. Lets add separate PR & issue for message string and it as blocker for #9071

Second creating separate issue for strings.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll update the PR to just check in the string. Once the string is localized we can use it.

const labelFallback = label || text || "";
    const ariaLabel = indicator
      ? messages.indicatorLabel?.replace("{label}", labelFallback)
      : labelFallback;

: labelFallback;

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": "{label} (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": "{label} (Indicator present)"
}
Loading