Skip to content

Commit 3180a02

Browse files
committed
docs(ui-motion,ui-toggle-details): update Transition and ToggleDetail examples to make screenreaders announce button text changes
Closes: INSTUI-4290, INSTUI-4312, INSTUI-4295
1 parent 35a2e76 commit 3180a02

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/ui-motion/src/Transition/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Example extends React.Component {
3030
<div>
3131
<div>
3232
<Button margin="small 0" size="small" onClick={this.handleButtonClick}>
33-
Fade {this.state.in ? 'Out' : 'In'}
33+
<div aria-live="polite">Fade {this.state.in ? 'Out' : 'In'}</div>
3434
</Button>
3535
</div>
3636
<Transition
@@ -75,7 +75,7 @@ class Example extends React.Component {
7575
<div>
7676
<div>
7777
<Button margin="small 0" size="small" onClick={this.handleButtonClick}>
78-
{this.state.in ? 'Collapse' : 'Expand'}
78+
<div aria-live="polite">{this.state.in ? 'Collapse' : 'Expand'}</div>
7979
</Button>
8080
</div>
8181
<Transition
@@ -161,7 +161,7 @@ class Example extends React.Component {
161161
{directionVariants.map(dir => <RadioInput key={dir.value} value={dir.value} label={dir.label} />)}
162162
</RadioInputGroup>
163163
<Button size="small" margin="medium none small" onClick={this.handleButtonClick}>
164-
Slide {this.state.in ? 'Out' : 'In'}
164+
<div aria-live="polite">Slide {this.state.in ? 'Out' : 'In'}</div>
165165
</Button>
166166
</div>
167167
<div style={{

packages/ui-toggle-details/src/ToggleDetails/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ ToggleDetails can be controlled:
3434
return (
3535
<div>
3636
<Button onClick={this.handleToggle}>
37-
This Button {this.state.expanded ? 'Collapses' : 'Expands'}
37+
<div aria-live="polite">
38+
This Button {this.state.expanded ? 'Collapses' : 'Expands'}
39+
</div>
3840
</Button>
3941
<br />
4042
<br />
@@ -69,7 +71,9 @@ ToggleDetails can be controlled:
6971
return (
7072
<div>
7173
<Button onClick={handleToggle}>
72-
This Button {expanded ? 'Collapses' : 'Expands'}
74+
<div aria-live="polite">
75+
This Button {expanded ? 'Collapses' : 'Expands'}
76+
</div>
7377
</Button>
7478
<br />
7579
<br />

0 commit comments

Comments
 (0)