Skip to content

Commit 957837d

Browse files
Add missing labels to Progress Indicator (salesforce#2926)
* Add label to step vertical * Add label: Step vertical with error
1 parent 2a15c20 commit 957837d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

components/progress-indicator/private/step-vertical.jsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class StepVertical extends React.Component {
5656
/**
5757
* stepIcon represents the icon used for each step.
5858
*/
59-
stepIcon = (renderIcon) => {
59+
stepIcon = (renderIcon, status, props) => {
6060
const data = {
6161
isSelected: this.props.isSelected,
6262
isError: this.props.isError,
@@ -87,6 +87,15 @@ class StepVertical extends React.Component {
8787
onClick={handleClick}
8888
>
8989
{icon}
90+
<span className="slds-assistive-text">
91+
{this.props.step.assistiveText || (
92+
<React.Fragment>
93+
{`${this.props.assistiveText.step} ${this.props.index + 1}: `}
94+
{this.props.step.label}
95+
{status ? ` - ${status}` : ''}
96+
</React.Fragment>
97+
)}
98+
</span>
9099
</button>
91100
) : (
92101
<span
@@ -99,6 +108,15 @@ class StepVertical extends React.Component {
99108
})}
100109
>
101110
{icon}
111+
<span className="slds-assistive-text">
112+
{this.props.step.assistiveText || (
113+
<React.Fragment>
114+
{`${props.assistiveText.step} ${props.index + 1}: `}
115+
{props.step.label}
116+
{status ? ` - ${status}` : ''}
117+
</React.Fragment>
118+
)}
119+
</span>
102120
</span>
103121
);
104122
};
@@ -143,6 +161,14 @@ class StepVertical extends React.Component {
143161

144162
render() {
145163
const renderIcon = this.props.isCompleted || this.props.isError;
164+
let status = '';
165+
if (this.props.isError) {
166+
status = this.props.assistiveText.errorStep;
167+
} else if (this.props.isCompleted) {
168+
status = this.props.assistiveText.completedStep;
169+
} else if (this.props.isDisabled) {
170+
status = this.props.assistiveText.disabledStep;
171+
}
146172

147173
return (
148174
<li
@@ -152,7 +178,7 @@ class StepVertical extends React.Component {
152178
'slds-has-error': this.props.isError,
153179
})}
154180
>
155-
{this.stepIcon(renderIcon)}
181+
{this.stepIcon(renderIcon, status, this.props)}
156182
{this.renderStepContent()}
157183
</li>
158184
);

0 commit comments

Comments
 (0)