Skip to content

Commit 4539946

Browse files
authored
Merge pull request #2 from MathuraMG/toolbar
Make toolbar accessible
2 parents 50c0354 + 7fd8471 commit 4539946

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

shared/components/Preview/PreviewFrame.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import ReactDOM from 'react-dom';
33

44
class PreviewFrame extends React.Component {
5-
5+
66
componentDidMount() {
77
if (this.props.isPlaying) {
88
this.renderFrameContents();
@@ -57,8 +57,8 @@ class PreviewFrame extends React.Component {
5757
}
5858

5959
render() {
60-
return <iframe className="preview-frame" frameBorder="0" sandbox="allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms"></iframe>;
60+
return <iframe className="preview-frame" frameBorder="0" sandbox="allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms" title="sketch output"></iframe>;
6161
}
6262
}
6363

64-
export default PreviewFrame;
64+
export default PreviewFrame;

shared/components/Toolbar/Toolbar.jsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ class Toolbar extends React.Component {
1010
render() {
1111
let playButtonClass = classNames({
1212
"toolbar__play-button": true,
13-
"playing": this.props.isPlaying
13+
"toolbar__play-button--selected": this.props.isPlaying
14+
});
15+
let stopButtonClass = classNames({
16+
"toolbar__stop-button": true,
17+
"toolbar__stop-button--selected": !this.props.isPlaying
1418
});
1519

1620
return (
1721
<div className="toolbar">
1822
<img className="toolbar__logo" src={logoUrl} alt="p5js Logo"/>
19-
<div className={playButtonClass} onClick={this.props.startSketch}>
23+
<button className={playButtonClass} onClick={this.props.startSketch}>
2024
<Isvg src={playUrl} alt="Play Sketch" />
21-
</div>
22-
{ this.props.isPlaying ?
23-
<div className="toolbar__stop-button" onClick={this.props.stopSketch}>
24-
<Isvg src={stopUrl} alt="Stop Sketch" />
25-
</div>
26-
: null }
25+
</button>
26+
<button className={stopButtonClass} onClick={this.props.stopSketch}>
27+
<Isvg src={stopUrl} alt="Stop Sketch" />
28+
</button>
2729
</div>
2830
);
2931
}
3032
}
3133

32-
export default Toolbar;
34+
export default Toolbar;

styles/abstracts/_placeholders.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
width: #{44 / $base-font-size}rem;
77
text-align: center;
88
border-radius: 100%;
9-
109
line-height: #{50 / $base-font-size}rem;
1110
cursor: pointer;
11+
border: none;
12+
outline: none;
1213

1314
& g {
1415
fill: $light-toolbar-button-color;
@@ -22,4 +23,10 @@
2223
fill: $light-button-hover-color;
2324
}
2425
}
25-
}
26+
&--selected {
27+
background-color: $light-button-background-hover-color;
28+
& g {
29+
fill: $light-button-hover-color;
30+
}
31+
}
32+
}

styles/components/_toolbar.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
.toolbar__play-button {
22
@extend %toolbar-button;
33
margin-right: #{15 / $base-font-size}rem;
4-
&.playing {
5-
background-color: $light-button-background-hover-color;
6-
& g {
7-
fill: $light-button-hover-color;
8-
}
4+
&--selected {
5+
@extend %toolbar-button--selected;
96
}
107
}
118

129
.toolbar__stop-button {
1310
@extend %toolbar-button;
11+
&--selected {
12+
@extend %toolbar-button--selected;
13+
}
1414
}
1515

1616
.toolbar__logo {
@@ -20,4 +20,4 @@
2020
.toolbar {
2121
padding: #{20 / $base-font-size}rem #{60 / $base-font-size}rem;
2222
display: flex;
23-
}
23+
}

0 commit comments

Comments
 (0)