Skip to content

Commit

Permalink
docs(ui-motion,ui-toggle-details): update Transition and ToggleDetail…
Browse files Browse the repository at this point in the history
… examples to make screenreaders announce button text changes

Closes: INSTUI-4290, INSTUI-4312, INSTUI-4295
  • Loading branch information
ToMESSKa committed Nov 22, 2024
1 parent 35a2e76 commit 3180a02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/ui-motion/src/Transition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Example extends React.Component {
<div>
<div>
<Button margin="small 0" size="small" onClick={this.handleButtonClick}>
Fade {this.state.in ? 'Out' : 'In'}
<div aria-live="polite">Fade {this.state.in ? 'Out' : 'In'}</div>
</Button>
</div>
<Transition
Expand Down Expand Up @@ -75,7 +75,7 @@ class Example extends React.Component {
<div>
<div>
<Button margin="small 0" size="small" onClick={this.handleButtonClick}>
{this.state.in ? 'Collapse' : 'Expand'}
<div aria-live="polite">{this.state.in ? 'Collapse' : 'Expand'}</div>
</Button>
</div>
<Transition
Expand Down Expand Up @@ -161,7 +161,7 @@ class Example extends React.Component {
{directionVariants.map(dir => <RadioInput key={dir.value} value={dir.value} label={dir.label} />)}
</RadioInputGroup>
<Button size="small" margin="medium none small" onClick={this.handleButtonClick}>
Slide {this.state.in ? 'Out' : 'In'}
<div aria-live="polite">Slide {this.state.in ? 'Out' : 'In'}</div>
</Button>
</div>
<div style={{
Expand Down
8 changes: 6 additions & 2 deletions packages/ui-toggle-details/src/ToggleDetails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ ToggleDetails can be controlled:
return (
<div>
<Button onClick={this.handleToggle}>
This Button {this.state.expanded ? 'Collapses' : 'Expands'}
<div aria-live="polite">
This Button {this.state.expanded ? 'Collapses' : 'Expands'}
</div>
</Button>
<br />
<br />
Expand Down Expand Up @@ -69,7 +71,9 @@ ToggleDetails can be controlled:
return (
<div>
<Button onClick={handleToggle}>
This Button {expanded ? 'Collapses' : 'Expands'}
<div aria-live="polite">
This Button {expanded ? 'Collapses' : 'Expands'}
</div>
</Button>
<br />
<br />
Expand Down

0 comments on commit 3180a02

Please sign in to comment.