Skip to content

Commit

Permalink
Include translation for Radio Btn Group Aria Label
Browse files Browse the repository at this point in the history
Signed-off-by: srikant <[email protected]>
  • Loading branch information
srikant-ch5 committed Jan 21, 2025
1 parent 7618951 commit 5f68bc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"table.toolbar.button.edit": "Edit",
"table.toolbar.button.cancel": "Cancel",
"table.toolbar.overflow.label": "Table Toolbar Overflow",
"radiobuttongroup.aria.label": "Radio Button Group",
"list.table.label": "Values",
"dropdown.tooltip.openMenu": "Open menu",
"dropdown.tooltip.closeMenu": "Close menu",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const MESSAGE_KEYS = {
TABLE_TOOLBAR_BUTTON_EDIT: "table.toolbar.button.edit",
TABLE_TOOLBAR_BUTTON_CANCEL: "table.toolbar.button.cancel",
TABLE_TOOLBAR_OVERFLOW_LABEL: "table.toolbar.overflow.label",
RADIO_BUTTON_GROUP_ARIA_LABEL: "radiobuttongroup.aria.label",
TABLE_DELETEICON_TOOLTIP: "table.deleteIcon.tooltip"

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import PropTypes from "prop-types";
import { connect } from "react-redux";
import { isEqual } from "lodash";
import * as ControlUtils from "./../../util/control-utils";
import * as PropertyUtils from "./../../util/property-utils";
import * as ConditionsUtils from "./../../ui-conditions/conditions-utils.js";
import ValidationMessage from "./../../components/validation-message";
import { RadioButton, RadioButtonGroup } from "@carbon/react";
import classNames from "classnames";
import { STATES, UPDATE_TYPE } from "./../../constants/constants.js";
import { MESSAGE_KEYS, STATES, UPDATE_TYPE } from "./../../constants/constants.js";
import { v4 as uuid4 } from "uuid";
import { Information } from "@carbon/react/icons";
import Tooltip from "./../../../tooltip/tooltip.jsx";
Expand Down Expand Up @@ -224,6 +225,8 @@ class RadiosetControl extends React.Component {
);
}

const radioBtnGroupAriaLabel = PropertyUtils.formatMessage(this.props.controller.getReactIntl(), MESSAGE_KEYS.RADIO_BUTTON_GROUP_ARIA_LABEL);

return (
<div data-id={ControlUtils.getDataId(this.props.control, this.props.propertyId)}
className={classNames("properties-radioset ", { "hide": this.props.state === STATES.HIDDEN })}
Expand All @@ -235,7 +238,7 @@ class RadiosetControl extends React.Component {
helperText={this.props.control.helperText}
readOnly={this.props.readOnly}
// Provide unique aria-label for each radio button group
aria-label={`Radio Button Group (${ControlUtils.getDataId(this.props.control, this.props.propertyId)})`}
aria-label={`${radioBtnGroupAriaLabel} (${ControlUtils.getDataId(this.props.control, this.props.propertyId)})`}
>
{buttons}
</RadioButtonGroup>
Expand Down

0 comments on commit 5f68bc8

Please sign in to comment.