1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Improve accessibility in the Preferences dialog

This commit makes the Preferences dialog more usable by accessibility devices like screen readers.

Previously, a screen reader would only read the content of the text boxes. By using JLabel's setLabelFor() feature (and in some extreme cases, setAccessibleName()), a screen reader will know that a label is assigned to a text field. For example, instead of just reading "12", it will now read "Editor font size: 12".
This commit is contained in:
Corey Knapp 2017-11-10 07:57:38 -05:00
parent 4b374dc16d
commit 9891a6ba21

View File

@ -174,6 +174,7 @@ public class Preferences extends javax.swing.JDialog {
jTabbedPane1.setRequestFocusEnabled(false); jTabbedPane1.setRequestFocusEnabled(false);
sketchbookLocationLabel.setText(tr("Sketchbook location:")); sketchbookLocationLabel.setText(tr("Sketchbook location:"));
sketchbookLocationLabel.setLabelFor(sketchbookLocationField);
sketchbookLocationField.setColumns(40); sketchbookLocationField.setColumns(40);
@ -188,20 +189,27 @@ public class Preferences extends javax.swing.JDialog {
requiresRestartLabel.setText(tr(" (requires restart of Arduino)")); requiresRestartLabel.setText(tr(" (requires restart of Arduino)"));
comboLanguage.getAccessibleContext().setAccessibleName("Editor language (requires restart of Arduino)");
fontSizeLabel.setText(tr("Editor font size: ")); fontSizeLabel.setText(tr("Editor font size: "));
fontSizeLabel.setLabelFor(fontSizeField);
fontSizeField.setColumns(4); fontSizeField.setColumns(4);
showVerboseLabel.setText(tr("Show verbose output during: ")); showVerboseLabel.setText(tr("Show verbose output during: "));
verboseCompilationBox.setText(tr("compilation ")); verboseCompilationBox.setText(tr("compilation "));
verboseCompilationBox.getAccessibleContext().setAccessibleName("Show verbose output during compilation");
verboseUploadBox.setText(tr("upload")); verboseUploadBox.setText(tr("upload"));
verboseUploadBox.getAccessibleContext().setAccessibleName("Show verbose output during upload");
comboWarningsLabel.setText(tr("Compiler warnings: ")); comboWarningsLabel.setText(tr("Compiler warnings: "));
comboWarningsLabel.setLabelFor(comboWarnings);
additionalBoardsManagerLabel.setText(tr("Additional Boards Manager URLs: ")); additionalBoardsManagerLabel.setText(tr("Additional Boards Manager URLs: "));
additionalBoardsManagerLabel.setToolTipText(tr("Enter a comma separated list of urls")); additionalBoardsManagerLabel.setToolTipText(tr("Enter a comma separated list of urls"));
additionalBoardsManagerLabel.setLabelFor(additionalBoardsManagerField);
additionalBoardsManagerField.setToolTipText(tr("Enter a comma separated list of urls")); additionalBoardsManagerField.setToolTipText(tr("Enter a comma separated list of urls"));
@ -212,6 +220,7 @@ public class Preferences extends javax.swing.JDialog {
extendedAdditionalUrlFieldWindowActionPerformed(evt); extendedAdditionalUrlFieldWindowActionPerformed(evt);
} }
}); });
extendedAdditionalUrlFieldWindow.getAccessibleContext().setAccessibleName("New Window");
morePreferencesLabel.setForeground(Color.GRAY); morePreferencesLabel.setForeground(Color.GRAY);
morePreferencesLabel.setText(tr("More preferences can be edited directly in the file")); morePreferencesLabel.setText(tr("More preferences can be edited directly in the file"));
@ -229,6 +238,7 @@ public class Preferences extends javax.swing.JDialog {
preferencesFileLabelMouseEntered(evt); preferencesFileLabelMouseEntered(evt);
} }
}); });
preferencesFileLabel.setFocusable(true);
arduinoNotRunningLabel.setForeground(Color.GRAY); arduinoNotRunningLabel.setForeground(Color.GRAY);
arduinoNotRunningLabel.setText(tr("(edit only when Arduino is not running)")); arduinoNotRunningLabel.setText(tr("(edit only when Arduino is not running)"));
@ -280,6 +290,7 @@ public class Preferences extends javax.swing.JDialog {
scaleSpinner.setModel(new javax.swing.SpinnerNumberModel(100, 100, 400, 5)); scaleSpinner.setModel(new javax.swing.SpinnerNumberModel(100, 100, 400, 5));
scaleSpinner.setEnabled(false); scaleSpinner.setEnabled(false);
scaleSpinner.getAccessibleContext().setAccessibleName("Interface scale (requires restart of Arduino)");
autoScaleCheckBox.setSelected(true); autoScaleCheckBox.setSelected(true);
autoScaleCheckBox.setText(tr("Automatic")); autoScaleCheckBox.setText(tr("Automatic"));
@ -288,6 +299,7 @@ public class Preferences extends javax.swing.JDialog {
autoScaleCheckBoxItemStateChanged(evt); autoScaleCheckBoxItemStateChanged(evt);
} }
}); });
autoScaleCheckBox.getAccessibleContext().setAccessibleName("Automatic interface scale (requires restart of Arduino");
jLabel3.setText("%"); jLabel3.setText("%");