Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 813b285

Browse files
authored
Changes to address Accessibility Insights (#276)
1 parent 3f5c81a commit 813b285

File tree

12 files changed

+38
-31
lines changed

12 files changed

+38
-31
lines changed

src/view/components/Dropdown.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import "../styles/Dropdown.css";
77
export interface IDropdownProps {
88
options: string[];
99
// styleLabel: string;
10+
name: string;
1011
onSelect?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
1112
}
1213

1314
export const Dropdown: React.FC<IDropdownProps> = props => {
1415
return (
15-
<select className="dropdown" onChange={props.onSelect}>
16+
<select
17+
className="dropdown"
18+
onChange={props.onSelect}
19+
name={props.name}
20+
>
1621
{renderOptions(props.options)}
1722
</select>
1823
);

src/view/components/cpx/CpxImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ const setupPins = (props: IProps): void => {
309309
svgPin.onkeydown = e => props.onKeyEvent(e, true);
310310
accessibility.setAria(
311311
svgPin,
312-
"Pin",
312+
"button",
313313
`Touch pin ${pinName.substr(pinName.length - 2)}`
314314
);
315315
}

src/view/components/cpx/__snapshots__/Cpx.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4015,9 +4015,9 @@ Array [
40154015
onMouseLeave={[Function]}
40164016
>
40174017
<button
4018-
aria-label="toolbar push-button"
4018+
aria-label="toolbar a-b-push"
40194019
className="toolbar-button button"
4020-
id="toolbar-push-button-button"
4020+
id="toolbar-a-b-push-button"
40214021
onClick={[Function]}
40224022
role="button"
40234023
style={

src/view/components/microbit/__snapshots__/Microbit.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,9 +2649,9 @@ Array [
26492649
onMouseLeave={[Function]}
26502650
>
26512651
<button
2652-
aria-label="toolbar microbit-button"
2652+
aria-label="toolbar microbit-a-b-push"
26532653
className="toolbar-button button"
2654-
id="toolbar-microbit-button-button"
2654+
id="toolbar-microbit-a-b-push-button"
26552655
onClick={[Function]}
26562656
role="button"
26572657
style={

src/view/components/toolbar/InputSlider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class InputSlider extends React.Component<ISliderProps, any, any> {
5151
onMouseUp={this.sendTelemetry}
5252
aria-valuenow={this.state.value}
5353
value={this.props.value}
54-
aria-label={`${this.props.type} sensor slider`}
54+
aria-label={`${this.props.type} sensor`}
5555
defaultValue={this.props.minValue.toLocaleString()}
5656
disabled={isInputDisabled}
5757
/>

src/view/components/toolbar/SensorButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class SensorButton extends React.Component<ISensorButtonProps> {
2121
render() {
2222
return (
2323
<button
24-
id={`${this.props.label}-button`}
24+
id={this.props.label}
2525
ref={this.buttonRef}
2626
onMouseUp={this.props.onMouseUp}
2727
onMouseDown={this.props.onMouseDown}
2828
onKeyUp={this.props.onKeyUp}
2929
onKeyDown={this.props.onKeyDown}
30-
aria-label={`${this.props.type} sensor button`}
30+
aria-label={`${this.props.type} sensor`}
3131
className="sensor-button"
3232
>
3333
{this.props.label}

src/view/components/toolbar/SensorModalUtils.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const CPX_TOOLBAR_ICON_ID = {
5454
LIGHT: "toolbar-light-sensor",
5555
MOTION: "toolbar-motion-sensor",
5656
NEO_PIXEL: "toolbar-neo-pixels",
57-
PUSH_BUTTON: "toolbar-push-button",
57+
PUSH_BUTTON: "toolbar-a-b-push",
5858
RED_LED: "toolbar-red-led",
5959
RIGHT_EDGE: "right-edge",
6060
SOUND: "toolbar-sound-sensor",
@@ -68,7 +68,7 @@ export const MICROBIT_TOOLBAR_ID = {
6868
LIGHT: "toolbar-light-sensor",
6969
ACCELEROMETER: "toolbar-accelerometer-sensor",
7070
LEDS: "toolbar-microbit-led",
71-
PUSH_BUTTON: "toolbar-microbit-button",
71+
PUSH_BUTTON: "toolbar-microbit-a-b-push",
7272
GPIO: "toolbar-gpio",
7373
SOUND: "toolbar-microbit-sound",
7474
WIRELESS: "toolbar-microbit-wireless",
@@ -187,11 +187,11 @@ export const PUSHB_MODAL_CONTENT = (
187187
sensorValues: { [key: string]: number }
188188
): IModalContent => {
189189
return {
190-
descriptionTitle: "toolbar-push-button.title",
190+
descriptionTitle: "toolbar-a-b-push.title",
191191
tagInput: TAG_INPUT_SVG,
192192
tagOutput: undefined,
193-
descriptionText: "toolbar-push-button.description",
194-
tryItDescription: "toolbar-push-button.tryItDescription",
193+
descriptionText: "toolbar-a-b-push.description",
194+
tryItDescription: "toolbar-a-b-push.tryItDescription",
195195
components: undefined,
196196
id: "push_btn",
197197
};
@@ -320,11 +320,11 @@ export const MICROBIT_BUTTON_CONTENT = (
320320
sensorValues: { [key: string]: number }
321321
): IModalContent => {
322322
return {
323-
descriptionTitle: "toolbar-microbit-button.title",
323+
descriptionTitle: "toolbar-microbit-a-b-push.title",
324324
tagInput: undefined,
325325
tagOutput: TAG_INPUT_SVG,
326-
descriptionText: "toolbar-microbit-button.description",
327-
tryItDescription: "toolbar-microbit-button.tryItDescription",
326+
descriptionText: "toolbar-microbit-a-b-push.description",
327+
tryItDescription: "toolbar-microbit-a-b-push.tryItDescription",
328328
components: undefined,
329329
id: "microbit_button",
330330
};

src/view/components/toolbar/ToolBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class ToolBar extends React.Component<IProps, IToolbarState, any> {
185185
onClick={this.onShowDescriptionClicked}
186186
iconProps={{ iconName: "Info" }}
187187
title="Info"
188-
ariaLabel="More Information Button"
188+
ariaLabel="More Information"
189189
className="info-icon"
190190
/>
191191
</span>

src/view/components/toolbar/motion/Accelerometer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class Accelerometer extends React.Component<IProps> {
7272
}}
7373
>
7474
<Dropdown
75+
name="gesture selection"
7576
options={GESTURES}
7677
onSelect={this.props.onSelectGestures}
7778
/>

src/view/components/toolbar/motion/__snapshots__/Accelerometer.spec.tsx.snap

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ exports[`Accelerometer component should render correctly 1`] = `
1818
>
1919
<select
2020
className="dropdown"
21+
name="gesture selection"
2122
>
2223
<option
2324
value="shake"
@@ -76,9 +77,9 @@ exports[`Accelerometer component should render correctly 1`] = `
7677
</option>
7778
</select>
7879
<button
79-
aria-label="gesture sensor button"
80+
aria-label="gesture sensor"
8081
className="sensor-button"
81-
id="Send Gesture-button"
82+
id="Send Gesture"
8283
onKeyDown={[Function]}
8384
onKeyUp={[Function]}
8485
onMouseDown={[Function]}
@@ -130,7 +131,7 @@ exports[`Accelerometer component should render correctly 1`] = `
130131
</span>
131132
</span>
132133
<input
133-
aria-label="motion_x sensor slider"
134+
aria-label="motion_x sensor"
134135
aria-valuemax={1023}
135136
aria-valuemin={-1023}
136137
aria-valuenow={1}
@@ -196,7 +197,7 @@ exports[`Accelerometer component should render correctly 1`] = `
196197
</span>
197198
</span>
198199
<input
199-
aria-label="motion_y sensor slider"
200+
aria-label="motion_y sensor"
200201
aria-valuemax={1023}
201202
aria-valuemin={-1023}
202203
aria-valuenow={0}
@@ -262,7 +263,7 @@ exports[`Accelerometer component should render correctly 1`] = `
262263
</span>
263264
</span>
264265
<input
265-
aria-label="motion_z sensor slider"
266+
aria-label="motion_z sensor"
266267
aria-valuemax={1023}
267268
aria-valuemin={-1023}
268269
aria-valuenow={1}

src/view/container/device/__snapshots__/Device.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,9 +2651,9 @@ exports[`Device component should render correctly 1`] = `
26512651
onMouseLeave={[Function]}
26522652
>
26532653
<button
2654-
aria-label="toolbar microbit-button"
2654+
aria-label="toolbar microbit-a-b-push"
26552655
className="toolbar-button button"
2656-
id="toolbar-microbit-button-button"
2656+
id="toolbar-microbit-a-b-push-button"
26572657
onClick={[Function]}
26582658
role="button"
26592659
style={

src/view/translations/en.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"toolbar-neo-pixels.description": "The 10 full color RGB LEDs surrounding the outer edge of the boards can be set to any color. Great for beautiful lighting effects!",
1515
"toolbar-neo-pixels.title": "NeoPixels",
1616
"toolbar-neo-pixels.tryItDescription": "Run your code and see the cool effects on the simulator!",
17-
"toolbar-push-button.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.",
18-
"toolbar-push-button.title": "Push Buttons",
19-
"toolbar-push-button.tryItDescription": "Click them with your mouse or by pressing “A” and/or “B” on your keyboard!",
17+
"toolbar-a-b-push.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.",
18+
"toolbar-a-b-push.title": "Push Buttons",
19+
"toolbar-a-b-push.tryItDescription": "Click them with your mouse or by pressing “A” and/or “B” on your keyboard!",
2020
"toolbar-red-led.description": "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.",
2121
"toolbar-red-led.title": "Red LED",
2222
"toolbar-red-led.tryItDescription": "Run your code and see the cool effects on the simulator!",
@@ -38,9 +38,9 @@
3838
"toolbar-microbit-led.title": "LEDs",
3939
"toolbar-microbit-led.description": "The microbit has 25 LEDs for you to play with. The LEDs have 9 levels of brightness.",
4040
"toolbar-microbit-led.tryItDescription": "Run your code and see the LEDs light up!",
41-
"toolbar-microbit-button.title": "Buttons",
42-
"toolbar-microbit-button.description": "There are two buttons on the front of the micro:bit (labelled A and B). The third button is to trigger both A and B buttons. You can detect when these buttons are pressed, allowing you to trigger code on the device.",
43-
"toolbar-microbit-button.tryItDescription": "Click them with your mouse or by pressing “A” and/or “B” on your keyboard!",
41+
"toolbar-microbit-a-b-push.title": "Buttons",
42+
"toolbar-microbit-a-b-push.description": "There are two buttons on the front of the micro:bit (labelled A and B). The third button is to trigger both A and B buttons. You can detect when these buttons are pressed, allowing you to trigger code on the device.",
43+
"toolbar-microbit-a-b-push.tryItDescription": "Click them with your mouse or by pressing “A” and/or “B” on your keyboard!",
4444
"toolbar-microbit-sound.title": "Sound",
4545
"toolbar-microbit-sound.description": "Your BBC micro:bit can be programmed to make a wide variety of sounds - from single notes, tones and beats to your own musical compositions.",
4646
"toolbar-microbit-sound.tryItDescription": "If you would like to see this sensor supported, please +1 the feature addition issue on GitHub! For now, you can try it on MakeCode!",

0 commit comments

Comments
 (0)