keep chart points out of the tab order, let the message dialog close after signing, and name the qr code, encoding and message dialog
What changed, and why it matters
This commit is an accessibility and user-experience patch for the Sparrow Wallet desktop app. It makes screen-reader navigation smoother by removing chart data points from the keyboard Tab order, naming QR code and encoding controls, and improving focus behavior after signing a message. It also fixes a small interaction bug where the Sign/Verify buttons in the message dialog would close the dialog instead of staying open to show results. There is no indication this change fixes a security vulnerability.
No security action required. Treat as a normal accessibility/usability improvement. If reviewing for release notes, note improved screen-reader and keyboard navigation.
Security signals we found
No security-relevant signals observed in the diff or commit message.
Changes are purely accessibility/UX focused.
Evidence from the diff
The diff adds a utility in AppServices to force chart plot children to remain non-focus-traversable, and applies it to BalanceChart, BlockTargetFeeRatesChart, and UtxosChart. It updates MessageSignDialog so the message text area moves focus on Tab, signing/verification actions consume the ActionEvent to keep the dialog open, the dialog title matches the header, and the signature field requests focus after signing. QRDisplayDialog gets accessible text for the QR image and encoding combo box. ServerSettingsController binds the test results area’s focus traversability to whether it has text. These are all accessibility/usability improvements.
Changed components
AppServices.javaBalanceChart.javaBlockTargetFeeRatesChart.javaMessageSignDialog.javaQRDisplayDialog.javaUtxosChart.javaServerSettingsController.javaInspect captured patch +54 / −14
### src/main/java/com/sparrowwallet/sparrow/AppServices.java
@@ -33,9 +33,12 @@
import javafx.application.ColorScheme;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.ReadOnlyProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
+import javafx.collections.ListChangeListener;
+import javafx.collections.ObservableList;
import javafx.concurrent.ScheduledService;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
@@ -103,6 +106,11 @@ public class AppServices {
private static final List<Double> LONG_FEE_RATES_RANGE = List.of(1d, 2d, 4d, 8d, 16d, 32d, 64d, 128d, 256d, 512d, 1024d, 2048d, 4096d, 8192d);
public static final double FALLBACK_FEE_RATE = 20000d / 1000;
public static final double TESTNET_FALLBACK_FEE_RATE = 1000d / 1000;
+ private static final ChangeListener<Boolean> NOT_FOCUS_TRAVERSABLE = (observable, wasTraversable, traversable) -> {
+ if(traversable) {
+ ((Node)((ReadOnlyProperty<?>)observable).getBean()).setFocusTraversable(false);
+ }
+ };
private static AppServices INSTANCE;
@@ -713,7 +721,7 @@ public static void onEscapePressed(Scene scene, Runnable runnable) {
});
}
- //Text areas holding keys, addresses or scripts never need a tab character, so Tab moves focus on rather than trapping keyboard users
+ //Text areas holding keys, addresses, scripts or messages to sign never need a typed tab character, so Tab moves focus on rather than trapping keyboard users
public static void moveFocusOnTab(Node node) {
node.addEventFilter(javafx.scene.input.KeyEvent.KEY_PRESSED, event -> {
if(event.getCode() == KeyCode.TAB && !event.isShortcutDown() && !event.isControlDown() && !event.isAltDown()) {
@@ -723,6 +731,20 @@ public static void moveFocusOnTab(Node node) {
});
}
+ //Charts make every data point a Tab stop while a screen reader is on, including points created before it started.
+ //The charts here are read as a one-line summary, so their points are kept out of the Tab order.
+ public static void keepChartPointsOutOfTabOrder(ObservableList<Node> plotChildren) {
+ plotChildren.addListener((ListChangeListener<Node>)change -> {
+ while(change.next()) {
+ for(Node node : change.getAddedSubList()) {
+ node.focusTraversableProperty().removeListener(NOT_FOCUS_TRAVERSABLE);
+ node.focusTraversableProperty().addListener(NOT_FOCUS_TRAVERSABLE);
+ node.setFocusTraversable(false);
+ }
+ }
+ });
+ }
+
public Map<Wallet, Storage> getOpenWallets() {
Map<Wallet, Storage> openWallets = new LinkedHashMap<>();
for(List<WalletTabData> walletTabDataList : walletWindows.values()) {
### src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java
@@ -3,6 +3,7 @@
import com.google.common.collect.Lists;
import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.wallet.Wallet;
+import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.wallet.Entry;
@@ -36,6 +37,7 @@ public class BalanceChart extends LineChart<Number, Number> {
public BalanceChart(@NamedArg("xAxis") Axis<Number> xAxis, @NamedArg("yAxis") Axis<Number> yAxis) {
super(xAxis, yAxis);
setAccessibleRole(AccessibleRole.TEXT);
+ AppServices.keepChartPointsOutOfTabOrder(getPlotChildren());
}
@Override
### src/main/java/com/sparrowwallet/sparrow/control/BlockTargetFeeRatesChart.java
@@ -23,6 +23,7 @@ public class BlockTargetFeeRatesChart extends LineChart<String, Number> {
public BlockTargetFeeRatesChart(@NamedArg("xAxis") Axis<String> xAxis, @NamedArg("yAxis") Axis<Number> yAxis) {
super(xAxis, yAxis);
setAccessibleRole(AccessibleRole.TEXT);
+ AppServices.keepChartPointsOutOfTabOrder(getPlotChildren());
}
@Override
### src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java
@@ -23,6 +23,7 @@
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands;
import com.sparrowwallet.sparrow.io.Storage;
import javafx.application.Platform;
+import javafx.event.ActionEvent;
import javafx.scene.AccessibleRole;
import javafx.scene.Node;
import javafx.scene.control.*;
@@ -122,7 +123,9 @@ public MessageSignDialog(Wallet wallet, WalletNode walletNode, String title, Str
dialogPane.getStylesheets().add(AppServices.class.getResource("general.css").toExternalForm());
dialogPane.getStylesheets().add(AppServices.class.getResource("dialog.css").toExternalForm());
AppServices.setStageIcon(dialogPane.getScene().getWindow());
- dialogPane.setHeaderText(title == null ? (wallet == null ? "Verify Message" : "Sign/Verify Message") : title);
+ String headerText = title == null ? (wallet == null ? "Verify Message" : "Sign/Verify Message") : title;
+ dialogPane.setHeaderText(headerText);
+ setTitle(headerText);
dialogPane.setGraphic(new WalletModelImage(WalletModel.SEED));
VBox vBox = new VBox();
@@ -150,6 +153,7 @@ public MessageSignDialog(Wallet wallet, WalletNode walletNode, String title, Str
messageField.setText("Message:");
message = new TextArea();
message.setWrapText(true);
+ AppServices.moveFocusOnTab(message);
message.setPrefRowCount(8);
message.setStyle("-fx-pref-height: 160px");
messageField.getInputs().add(message);
@@ -226,14 +230,17 @@ public MessageSignDialog(Wallet wallet, WalletNode walletNode, String title, Str
signButton.setDisable(!canSign);
signButton.setGraphic(getGlyph(getSignGlyph()));
signButton.setGraphicTextGap(5);
- signButton.setOnAction(event -> {
+ //Signing and verifying keep the dialog open, so the action is consumed before the dialog pane sets a result and closes
+ signButton.addEventFilter(ActionEvent.ACTION, event -> {
signMessage();
+ event.consume();
});
Button verifyButton = (Button) dialogPane.lookupButton(verifyButtonType);
verifyButton.setDefaultButton(false);
- verifyButton.setOnAction(event -> {
+ verifyButton.addEventFilter(ActionEvent.ACTION, event -> {
verifyMessage();
+ event.consume();
});
boolean validAddress = isValidAddress();
@@ -281,11 +288,6 @@ public MessageSignDialog(Wallet wallet, WalletNode walletNode, String title, Str
EventManager.get().register(this);
setOnCloseRequest(event -> {
- if(ButtonBar.ButtonData.APPLY.equals(getResult())) {
- event.consume();
- return;
- }
-
if(!closed) {
EventManager.get().unregister(this);
closed = true;
@@ -294,7 +296,7 @@ public MessageSignDialog(Wallet wallet, WalletNode walletNode, String title, Str
AppServices.onEscapePressed(dialogPane.getScene(), () -> setResult(ButtonBar.ButtonData.CANCEL_CLOSE));
AppServices.moveToActiveWindowScreen(this);
- setResultConverter(dialogButton -> dialogButton == signButtonType || dialogButton == verifyButtonType ? ButtonBar.ButtonData.APPLY : dialogButton.getButtonData());
+ setResultConverter(ButtonType::getButtonData);
Platform.runLater(() -> {
if(address.getText().isEmpty()) {
@@ -408,8 +410,7 @@ private void signUnencryptedKeystore(Wallet decryptedWallet) {
signatureText = privKey.signMessage(message.getText().trim(), scriptType);
}
}
- signature.clear();
- signature.appendText(signatureText);
+ showSignature(signatureText);
} catch(Exception e) {
log.error("Could not sign message", e);
AppServices.showErrorDialog("Could not sign message", e.getMessage());
@@ -423,11 +424,17 @@ private void signDeviceKeystore(Wallet deviceWallet) {
deviceSignMessageDialog.initOwner(getDialogPane().getScene().getWindow());
Optional<String> optSignature = deviceSignMessageDialog.showAndWait();
if(optSignature.isPresent()) {
- signature.clear();
- signature.appendText(optSignature.get());
+ showSignature(optSignature.get());
}
}
+ //Focus moves to the new signature so it is read out, rather than being filled in silently behind the Sign button
+ private void showSignature(String signatureText) {
+ signature.clear();
+ signature.appendText(signatureText);
+ signature.requestFocus();
+ }
+
private void verifyMessage() {
try {
//Find ECKey from message and signature
### src/main/java/com/sparrowwallet/sparrow/control/QRDisplayDialog.java
@@ -121,6 +121,7 @@ public QRDisplayDialog(UR ur, BBQR bbqr, String raw, boolean addLegacyEncodingOp
StackPane stackPane = new StackPane();
qrImageView = new ImageView();
+ qrImageView.setAccessibleText("QR code");
stackPane.getChildren().add(qrImageView);
qrImageView.setOnScroll(scrollEvent -> {
@@ -195,6 +196,7 @@ public QRDisplayDialog(String data, boolean addScanButton) {
StackPane stackPane = new StackPane();
qrImageView = new ImageView();
+ qrImageView.setAccessibleText("QR code");
stackPane.getChildren().add(qrImageView);
dialogPane.setContent(Borders.wrap(stackPane).lineBorder().buildAll());
@@ -429,6 +431,8 @@ protected Node createButton(ButtonType buttonType) {
encodingComboBox.setCellFactory(_ -> new QREncodingListCell());
encodingComboBox.setButtonCell(new QREncodingButtonCell());
encodingComboBox.setValue(encoding);
+ //Named like the density pop-up beside it ("Medium Density"); the button shows only the encoding's name
+ encodingComboBox.accessibleTextProperty().bind(encodingComboBox.valueProperty().map(value -> value.getName() + " Encoding"));
encodingComboBox.setOnAction(_ -> {
setEncoding(encodingComboBox.getValue());
Config.get().setQrEncoding(encodingComboBox.getValue());
### src/main/java/com/sparrowwallet/sparrow/control/UtxosChart.java
@@ -2,6 +2,7 @@
import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.wallet.Wallet;
+import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.wallet.Entry;
@@ -34,6 +35,7 @@ public class UtxosChart extends BarChart<String, Number> {
public UtxosChart(@NamedArg("xAxis") Axis<String> xAxis, @NamedArg("yAxis") Axis<Number> yAxis) {
super(xAxis, yAxis);
setAccessibleRole(AccessibleRole.TEXT);
+ AppServices.keepChartPointsOutOfTabOrder(getPlotChildren());
}
@Override
### src/main/java/com/sparrowwallet/sparrow/settings/ServerSettingsController.java
@@ -195,6 +195,8 @@ public void initializeView(Config config) {
publicElectrumForm.managedProperty().bind(publicElectrumForm.visibleProperty());
coreForm.managedProperty().bind(coreForm.visibleProperty());
electrumForm.managedProperty().bind(electrumForm.visibleProperty());
+ //The results area is blank until a connection is tested, and an empty, unnamed Tab stop tells a screen reader user nothing
+ testResults.focusTraversableProperty().bind(testResults.textProperty().isNotEmpty());
serverTypeToggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
if(serverTypeToggleGroup.getSelectedToggle() != null) {
ServerType existingType = config.getServerType();Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.