mirror of https://github.com/qt/qtdoc.git
Improve calqlatr accessibility
Add accessibility annotations to make the screen readers read out the content correctly. For instance, VoiceOver on macOS reads "x²" as "x two", where it should be "x squared". Also give a more descriptive accessible name to the somewhat unfortunately named "BS" button. The Text items in the Display also need Accessible.name, since Text is a low-level item which do not provide a11y content by itself. Fix issue with handling the Press action: the a11y system does not call the mouse "press" or "release" signals in response to this action, use "clicked" instead. Pick-to: 6.10 Change-Id: I9c4cccf1b60c55320a149f97c86edea92a47bbb5 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Konsta Alajärvi <konsta.alajarvi@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
This commit is contained in:
parent
e4b2677839
commit
9f2de0e371
|
@ -16,6 +16,7 @@ RoundButton {
|
|||
// include this text property as the calculator engine
|
||||
// differentiates buttons through text. The text is never drawn.
|
||||
text: "bs"
|
||||
Accessible.name: "backspace"
|
||||
|
||||
property bool dimmable: true
|
||||
property bool dimmed: false
|
||||
|
@ -56,7 +57,7 @@ RoundButton {
|
|||
return "images/backspace.svg";
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
onClicked: {
|
||||
root.operatorPressed("bs");
|
||||
updateDimmed();
|
||||
}
|
||||
|
|
|
@ -160,12 +160,14 @@ Item {
|
|||
font.pixelSize: display.fontSize
|
||||
color: display.qtGreenColor
|
||||
text: parent.operator
|
||||
Accessible.name: parent.operator
|
||||
}
|
||||
Text {
|
||||
font.pixelSize: display.fontSize
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 16
|
||||
text: parent.operand
|
||||
Accessible.name: parent.operand
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,14 +31,14 @@ Item {
|
|||
}
|
||||
|
||||
component DigitButton: CalculatorButton {
|
||||
onReleased: {
|
||||
onClicked: {
|
||||
root.digitPressed(text);
|
||||
updateDimmed();
|
||||
}
|
||||
}
|
||||
|
||||
component OperatorButton: CalculatorButton {
|
||||
onReleased: {
|
||||
onClicked: {
|
||||
root.operatorPressed(text);
|
||||
updateDimmed();
|
||||
}
|
||||
|
@ -65,14 +65,32 @@ Item {
|
|||
rowSpacing: controller.spacing
|
||||
visible: !isPortraitMode
|
||||
|
||||
OperatorButton { text: "x²" }
|
||||
OperatorButton { text: "⅟x" }
|
||||
OperatorButton {
|
||||
text: "x²"
|
||||
Accessible.name: "x squared"
|
||||
}
|
||||
OperatorButton {
|
||||
text: "⅟x"
|
||||
Accessible.name: "one over x"
|
||||
}
|
||||
OperatorButton { text: "√" }
|
||||
OperatorButton { text: "x³" }
|
||||
OperatorButton { text: "sin" }
|
||||
OperatorButton { text: "|x|" }
|
||||
OperatorButton {
|
||||
text: "x³"
|
||||
Accessible.name: "x cubed"
|
||||
}
|
||||
OperatorButton {
|
||||
text: "sin"
|
||||
Accessible.name: "sine"
|
||||
}
|
||||
OperatorButton {
|
||||
text: "|x|"
|
||||
Accessible.name: "absolute value"
|
||||
}
|
||||
OperatorButton { text: "log" }
|
||||
OperatorButton { text: "cos" }
|
||||
OperatorButton {
|
||||
text: "cos"
|
||||
Accessible.name: "cosine"
|
||||
}
|
||||
DigitButton {
|
||||
text: "e"
|
||||
dimmable: true
|
||||
|
|
Loading…
Reference in New Issue