Skip to content

Commit 2353ec5

Browse files
Simulator accessibility improvements. (#948)
* Add aria-valuetext to range sensor slider * Prevent tooltip from being read by screen reader where it duplicates the aria-valuetext * Screen reader values for threshold marks * Visually hidden text to identify radio messages Co-authored-by: Matt Hillsdon <[email protected]>
1 parent d4f7de8 commit 2353ec5

17 files changed

+175
-15
lines changed

lang/ui.en.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,10 @@
903903
"defaultMessage": "Radio",
904904
"description": "Radio simulator panel title"
905905
},
906+
"simulator-radio-code": {
907+
"defaultMessage": "micro:bit sent:",
908+
"description": "Visually hidden text for a radio message sent from the simulated micro:bit. Text of the message follows."
909+
},
906910
"simulator-radio-group-notice": {
907911
"defaultMessage": "Radio group set to {groupNumber}",
908912
"description": "Message in radio simulator area when the radio group changes"
@@ -927,6 +931,10 @@
927931
"defaultMessage": "Send message",
928932
"description": "Aria label for the simulator radio send button"
929933
},
934+
"simulator-radio-user": {
935+
"defaultMessage": "You sent:",
936+
"description": "Visually hidden text for a radio message sent from the user to the simulated micro:bit. Text of the message follows."
937+
},
930938
"simulator-reference-link": {
931939
"defaultMessage": "Link to Reference section",
932940
"description": "Aria label for simulator Reference link button"

lang/ui.es-es.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "Radio",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "Grupo de radio configurado a {groupNumber}",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "Enviar mensaje",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "Enlace a la sección de referencia",
931939
"description": "Aria label for simulator Reference link button"

lang/ui.fr.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "Radio",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "Le groupe radio est réglé sur {groupNumber}",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "Envoyer un message",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "Lien vers la section de référence",
931939
"description": "Aria label for simulator Reference link button"

lang/ui.ja.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "無線",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "無線のグループを{groupNumber}に設定",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "メッセージを送信",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "参照セクションへのリンク",
931939
"description": "Aria label for simulator Reference link button"

lang/ui.ko.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "라디오",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "라디오 그룹이 {groupNumber}(으)로 설정됨",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "메시지 전송",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "레퍼런스 섹션에 링크하기",
931939
"description": "Aria label for simulator Reference link button"

lang/ui.zh-cn.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "无线电",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "无线电组设置为 {groupNumber}",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "发送消息",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "链接到 Reference (参考)部分",
931939
"description": "Aria label for simulator Reference link button"

lang/ui.zh-tw.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@
902902
"defaultMessage": "無線電",
903903
"description": "Radio simulator panel title"
904904
},
905+
"simulator-radio-code": {
906+
"defaultMessage": "Radio message from the micro:bit simulator",
907+
"description": "Aria label for a message sent from the micro:bit simulator"
908+
},
905909
"simulator-radio-group-notice": {
906910
"defaultMessage": "無線電組設定為 {groupNumber}",
907911
"description": "Message in radio simulator area when the radio group changes"
@@ -926,6 +930,10 @@
926930
"defaultMessage": "傳送訊息",
927931
"description": "Aria label for the simulator radio send button"
928932
},
933+
"simulator-radio-user": {
934+
"defaultMessage": "Radio message to the micro:bit simulator",
935+
"description": "Aria label for a message sent to the micro:bit simulator"
936+
},
929937
"simulator-reference-link": {
930938
"defaultMessage": "參考區的連結",
931939
"description": "Aria label for simulator Reference link button"

src/messages/ui.en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,12 @@
20172017
"value": "Radio"
20182018
}
20192019
],
2020+
"simulator-radio-code": [
2021+
{
2022+
"type": 0,
2023+
"value": "micro:bit sent:"
2024+
}
2025+
],
20202026
"simulator-radio-group-notice": [
20212027
{
20222028
"type": 0,
@@ -2057,6 +2063,12 @@
20572063
"value": "Send message"
20582064
}
20592065
],
2066+
"simulator-radio-user": [
2067+
{
2068+
"type": 0,
2069+
"value": "You sent:"
2070+
}
2071+
],
20602072
"simulator-reference-link": [
20612073
{
20622074
"type": 0,

src/messages/ui.es-es.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,12 @@
20092009
"value": "Radio"
20102010
}
20112011
],
2012+
"simulator-radio-code": [
2013+
{
2014+
"type": 0,
2015+
"value": "Radio message from the micro:bit simulator"
2016+
}
2017+
],
20122018
"simulator-radio-group-notice": [
20132019
{
20142020
"type": 0,
@@ -2049,6 +2055,12 @@
20492055
"value": "Enviar mensaje"
20502056
}
20512057
],
2058+
"simulator-radio-user": [
2059+
{
2060+
"type": 0,
2061+
"value": "Radio message to the micro:bit simulator"
2062+
}
2063+
],
20522064
"simulator-reference-link": [
20532065
{
20542066
"type": 0,

src/messages/ui.fr.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,12 @@
20092009
"value": "Radio"
20102010
}
20112011
],
2012+
"simulator-radio-code": [
2013+
{
2014+
"type": 0,
2015+
"value": "Radio message from the micro:bit simulator"
2016+
}
2017+
],
20122018
"simulator-radio-group-notice": [
20132019
{
20142020
"type": 0,
@@ -2049,6 +2055,12 @@
20492055
"value": "Envoyer un message"
20502056
}
20512057
],
2058+
"simulator-radio-user": [
2059+
{
2060+
"type": 0,
2061+
"value": "Radio message to the micro:bit simulator"
2062+
}
2063+
],
20522064
"simulator-reference-link": [
20532065
{
20542066
"type": 0,

src/messages/ui.ja.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,12 @@
19991999
"value": "無線"
20002000
}
20012001
],
2002+
"simulator-radio-code": [
2003+
{
2004+
"type": 0,
2005+
"value": "Radio message from the micro:bit simulator"
2006+
}
2007+
],
20022008
"simulator-radio-group-notice": [
20032009
{
20042010
"type": 0,
@@ -2043,6 +2049,12 @@
20432049
"value": "メッセージを送信"
20442050
}
20452051
],
2052+
"simulator-radio-user": [
2053+
{
2054+
"type": 0,
2055+
"value": "Radio message to the micro:bit simulator"
2056+
}
2057+
],
20462058
"simulator-reference-link": [
20472059
{
20482060
"type": 0,

src/messages/ui.ko.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,12 @@
20172017
"value": "라디오"
20182018
}
20192019
],
2020+
"simulator-radio-code": [
2021+
{
2022+
"type": 0,
2023+
"value": "Radio message from the micro:bit simulator"
2024+
}
2025+
],
20202026
"simulator-radio-group-notice": [
20212027
{
20222028
"type": 0,
@@ -2061,6 +2067,12 @@
20612067
"value": "메시지 전송"
20622068
}
20632069
],
2070+
"simulator-radio-user": [
2071+
{
2072+
"type": 0,
2073+
"value": "Radio message to the micro:bit simulator"
2074+
}
2075+
],
20642076
"simulator-reference-link": [
20652077
{
20662078
"type": 0,

src/messages/ui.zh-cn.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,12 @@
20142014
"value": "无线电"
20152015
}
20162016
],
2017+
"simulator-radio-code": [
2018+
{
2019+
"type": 0,
2020+
"value": "Radio message from the micro:bit simulator"
2021+
}
2022+
],
20172023
"simulator-radio-group-notice": [
20182024
{
20192025
"type": 0,
@@ -2054,6 +2060,12 @@
20542060
"value": "发送消息"
20552061
}
20562062
],
2063+
"simulator-radio-user": [
2064+
{
2065+
"type": 0,
2066+
"value": "Radio message to the micro:bit simulator"
2067+
}
2068+
],
20572069
"simulator-reference-link": [
20582070
{
20592071
"type": 0,

src/messages/ui.zh-tw.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,12 @@
20062006
"value": "無線電"
20072007
}
20082008
],
2009+
"simulator-radio-code": [
2010+
{
2011+
"type": 0,
2012+
"value": "Radio message from the micro:bit simulator"
2013+
}
2014+
],
20092015
"simulator-radio-group-notice": [
20102016
{
20112017
"type": 0,
@@ -2046,6 +2052,12 @@
20462052
"value": "傳送訊息"
20472053
}
20482054
],
2055+
"simulator-radio-user": [
2056+
{
2057+
"type": 0,
2058+
"value": "Radio message to the micro:bit simulator"
2059+
}
2060+
],
20492061
"simulator-reference-link": [
20502062
{
20512063
"type": 0,

src/simulator/CompassModule.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import { Box, HStack, Icon, Stack, Text } from "@chakra-ui/react";
77
import { ReactNode, useEffect, useRef } from "react";
8-
import { FormattedMessage } from "react-intl";
8+
import { FormattedMessage, useIntl } from "react-intl";
99
import {
1010
RangeSensor as RangeSensorType,
1111
SensorStateKey,
@@ -29,6 +29,7 @@ const CompassModule = ({
2929
minimised,
3030
}: CompassModuleProps) => {
3131
const ref = useRef<SVGSVGElement>(null);
32+
const intl = useIntl();
3233
const compassHeading = state["compassHeading"];
3334
useEffect(() => {
3435
const needle = ref.current?.querySelector("#Needle");
@@ -44,7 +45,7 @@ const CompassModule = ({
4445
<RangeSensor
4546
id="compassHeading"
4647
icon={icon}
47-
title="compass heading"
48+
title={intl.formatMessage({ id: "simulator-compass-heading-one" })}
4849
sensor={compassHeading as RangeSensorType}
4950
onSensorChange={onValueChange}
5051
minimised={minimised}
@@ -55,11 +56,14 @@ const CompassModule = ({
5556
<FormattedMessage id="simulator-compass-heading-one" />
5657
</Text>
5758
<HStack spacing={3} pl={4} width="100%">
58-
<Axis
59-
axis="compassHeading"
60-
label=""
61-
state={state}
62-
onValueChange={onValueChange}
59+
<RangeSensor
60+
id="compassHeading"
61+
title={intl.formatMessage({
62+
id: "simulator-compass-heading-one",
63+
})}
64+
sensor={compassHeading as RangeSensorType}
65+
onSensorChange={onValueChange}
66+
minimised={minimised}
6367
/>
6468
<Icon
6569
ref={ref}

0 commit comments

Comments
 (0)