Skip to content

Commit 8d63d17

Browse files
Progress Indicator: Update assistiveText
- Remove trailing - on step without status - Pass correct assistiveText to step - Remove activeStep from docs
1 parent f88853b commit 8d63d17

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

components/progress-indicator/index.jsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import React from 'react';
77
import PropTypes from 'prop-types';
88

9-
import assign from 'lodash.assign';
10-
119
import find from 'lodash.find';
1210

1311
// ### shortid
@@ -26,15 +24,13 @@ const propTypes = {
2624
/**
2725
* **Assistive text for accessibility**
2826
* This object is merged with the default props object on every render.
29-
* * `activeStep`: Label for the active step. The default is `Active Step`
3027
* * `completedStep`: Label for a completed step. The default is `Completed Step`
3128
* * `disabledStep`: Label for disabled step. The default is `Disabled Step`
3229
* * `errorStep`: Label for a step with an error. The default is `Error Step`
3330
* * `percentage`: Label for Progress Bar. The default is `Progress: [this.props.value]%`. You will need to calculate the percentage yourself if changing this string.
3431
* * `step`: Label for a step. It will be typically followed by the number of the step such as "Step 1".
3532
*/
3633
assistiveText: PropTypes.shape({
37-
activeStep: PropTypes.string,
3834
completedStep: PropTypes.string,
3935
disabledStep: PropTypes.string,
4036
percentage: PropTypes.string,
@@ -179,9 +175,10 @@ class ProgressIndicator extends React.Component {
179175

180176
render () {
181177
// Merge objects of strings with their default object
182-
const assistiveText = this.props
183-
? assign({}, defaultProps.assistiveText, this.props.assistiveText)
184-
: defaultProps.assistiveText;
178+
const assistiveText = {
179+
...defaultProps.assistiveText,
180+
...this.props.assistiveText,
181+
};
185182

186183
const {
187184
selectedStep,
@@ -219,7 +216,7 @@ class ProgressIndicator extends React.Component {
219216
>
220217
{allSteps.map((step, i) => (
221218
<Step
222-
assistiveText={this.props.assistiveText}
219+
assistiveText={assistiveText}
223220
key={`${this.getId()}-${step.id}`}
224221
id={this.getId()}
225222
index={i}

components/progress-indicator/private/step.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ class Step extends React.Component {
130130
{icon}
131131
<span className="slds-assistive-text">
132132
{this.props.step.assistiveText ||
133-
`${props.assistiveText.step} ${props.index + 1}: ${props.step.label} - ${status}`}
133+
`${props.assistiveText.step} ${props.index + 1}: ${
134+
props.step.label
135+
} - ${status}`}
134136
</span>
135137
</a>
136138
) : (
@@ -150,7 +152,9 @@ class Step extends React.Component {
150152
{icon}
151153
<span className="slds-assistive-text">
152154
{this.props.step.assistiveText ||
153-
`${props.assistiveText.step} ${props.index + 1}: ${props.step.label}${status ? " - " + status : ""}`}
155+
`${props.assistiveText.step} ${props.index + 1}: ${
156+
props.step.label
157+
}${status ? ` - ${status}` : ''}`}
154158
</span>
155159
</button>
156160
);

tests/__snapshots__/story-based-tests.snapshot-test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,7 +3908,7 @@ exports[`DOM snapshots SLDSProgressIndicator Completed Progress 1`] = `
39083908
<span
39093909
className="slds-assistive-text"
39103910
>
3911-
undefined 2: tooltip label #2 - Finished this step.
3911+
Step 2: tooltip label #2 - Finished this step.
39123912
</span>
39133913
</button>
39143914
<span />
@@ -3946,7 +3946,7 @@ exports[`DOM snapshots SLDSProgressIndicator Completed Progress 1`] = `
39463946
<span
39473947
className="slds-assistive-text"
39483948
>
3949-
undefined 3: [object Object] - Finished this step.
3949+
Step 3: [object Object] - Finished this step.
39503950
</span>
39513951
</button>
39523952
<span />
@@ -3976,7 +3976,7 @@ exports[`DOM snapshots SLDSProgressIndicator Completed Progress 1`] = `
39763976
<span
39773977
className="slds-assistive-text"
39783978
>
3979-
undefined 4: tooltip label #4
3979+
Step 4: tooltip label #4
39803980
</span>
39813981
</button>
39823982
<span />
@@ -4006,7 +4006,7 @@ exports[`DOM snapshots SLDSProgressIndicator Completed Progress 1`] = `
40064006
<span
40074007
className="slds-assistive-text"
40084008
>
4009-
undefined 5: tooltip label #5
4009+
Step 5: tooltip label #5
40104010
</span>
40114011
</button>
40124012
<span />

0 commit comments

Comments
 (0)