browse the server and sweep lists before choosing, keep the transaction status current for screen readers, and name alert icons
What changed, and why it matters
This commit improves accessibility and refines how combo-box lists behave. It adds screen-reader labels to server-selection and wallet-sweep dropdowns, gives alert icons meaningful names, and makes the transaction-status label readable by assistive technology. It also centralizes the 'browse before choosing' dropdown logic so keyboard/click selection works consistently. There is no security-relevant change visible in the diff.
No security action required; treat as a routine accessibility/usability improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a UI/UX and accessibility refactor. AppServices.java names DialogPane header ImageViews based on the alert style class. ComboBoxTextField.java introduces setOnChoose() to handle keyboard browsing and explicit Enter/Space/click selection. ServerSettingsController.java, PrivateKeySweepDialog.java, and PaymentController.java adopt this helper and add accessibleText to combo boxes. HeadersController.java binds blockStatus accessible text and sets its accessible role to TEXT_FIELD. server.fxml adds accessibleText attributes. No cryptographic, network, or privilege changes are present.
Changed components
src/main/java/com/sparrowwallet/sparrow/AppServices.javasrc/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.javasrc/main/java/com/sparrowwallet/sparrow/control/PrivateKeySweepDialog.javasrc/main/java/com/sparrowwallet/sparrow/settings/ServerSettingsController.javasrc/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.javasrc/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.javasrc/main/resources/com/sparrowwallet/sparrow/settings/server.fxmlInspect captured patch +91 / −65
### src/main/java/com/sparrowwallet/sparrow/AppServices.java
@@ -49,6 +49,7 @@
import javafx.scene.control.*;
import javafx.scene.control.Dialog;
import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.text.Font;
import javafx.stage.Screen;
@@ -75,7 +76,9 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static com.sparrowwallet.sparrow.AppController.CONNECTION_FAILED_PREFIX;
import static com.sparrowwallet.sparrow.control.DownloadVerifierDialog.*;
@@ -1017,6 +1020,17 @@ public static void setStageIcon(Window window) {
if(OsType.getCurrent() == OsType.MACOS && stage.getScene().getRoot().getAccessibleRole() == AccessibleRole.DIALOG) {
stage.getScene().getRoot().setAccessibleRole(AccessibleRole.PARENT);
}
+ //The icon an alert style puts in the dialog header is otherwise read as an unnamed image
+ if(stage.getScene().getRoot() instanceof DialogPane dialogPane) {
+ Consumer<Node> nameAlertIcon = graphic -> {
+ if(graphic instanceof ImageView && graphic.getAccessibleText() == null) {
+ Stream.of("warning", "error", "information", "confirmation").filter(dialogPane.getStyleClass()::contains).findFirst()
+ .ifPresent(kind -> graphic.setAccessibleText(Character.toUpperCase(kind.charAt(0)) + kind.substring(1)));
+ }
+ };
+ dialogPane.graphicProperty().addListener((_, _, graphic) -> nameAlertIcon.accept(graphic));
+ nameAlertIcon.accept(dialogPane.getGraphic());
+ }
}
}
### src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java
@@ -8,22 +8,29 @@
import javafx.scene.control.ComboBox;
import javafx.scene.control.ComboBoxBase;
import javafx.scene.control.ContextMenu;
+import javafx.scene.control.ListCell;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
+import javafx.scene.control.Skin;
+import javafx.scene.control.skin.ComboBoxListViewSkin;
import javafx.scene.input.Clipboard;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
+import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import org.controlsfx.control.textfield.CustomTextField;
import java.util.List;
+import java.util.function.Consumer;
public class ComboBoxTextField extends CustomTextField {
private final ObjectProperty<ComboBox<?>> comboProperty = new SimpleObjectProperty<>();
private boolean initialized;
private boolean comboShowing;
+ private Object browsedItem;
+ private boolean chooseBrowsedItem;
public ComboBoxTextField() {
super();
@@ -75,15 +82,7 @@ private void setupComboButtonField(ObjectProperty<Node> rightProperty) {
comboShowing = !comboShowing;
if(!initialized) {
- comboProperty.get().valueProperty().addListener((observable, oldValue, newValue) -> {
- comboShowing = false;
- //While the list is open the value follows the highlighted item, which clearing would reset
- if(!comboProperty.get().isShowing()) {
- Platform.runLater(() -> comboProperty.get().getSelectionModel().clearSelection());
- }
- });
- //A choice made while the list is open is cleared once it closes, so the same item can be chosen again
- comboProperty.get().addEventHandler(ComboBoxBase.ON_HIDDEN, event -> Platform.runLater(() -> comboProperty.get().getSelectionModel().clearSelection()));
+ comboProperty.get().valueProperty().addListener((observable, oldValue, newValue) -> comboShowing = false);
initialized = true;
}
}
@@ -92,6 +91,65 @@ private void setupComboButtonField(ObjectProperty<Node> rightProperty) {
rightProperty.set(showComboButtonPane);
}
+ /**
+ * Calls onChoose with the item chosen from the list. While the list is open its value follows the highlighted item, so arrow keys
+ * browse and an item is only chosen by Enter, Space or a click on it; closing the list any other way chooses nothing. A value set
+ * while the list is closed is chosen at once. The selection is cleared after each choice, so the same item can be chosen again.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void setOnChoose(Consumer<T> onChoose) {
+ ComboBox<T> combo = (ComboBox<T>)comboProperty.get();
+ combo.valueProperty().addListener((observable, oldValue, item) -> {
+ if(item != null) {
+ if(combo.isShowing()) {
+ browsedItem = item;
+ } else {
+ Platform.runLater(() -> combo.getSelectionModel().clearSelection());
+ onChoose.accept(item);
+ }
+ }
+ });
+ combo.addEventHandler(ComboBoxBase.ON_HIDDEN, event -> {
+ T item = chooseBrowsedItem ? (T)browsedItem : null;
+ browsedItem = null;
+ chooseBrowsedItem = false;
+ Platform.runLater(() -> combo.getSelectionModel().clearSelection());
+ if(item != null) {
+ onChoose.accept(item);
+ }
+ });
+ //Arrow keys on the closed combo open the list rather than choosing the next item
+ combo.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
+ if((event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN) && !combo.isShowing()) {
+ combo.show();
+ event.consume();
+ }
+ });
+ Consumer<Skin<?>> addChooseFilters = skin -> {
+ if(skin instanceof ComboBoxListViewSkin<?> listViewSkin) {
+ Node popupContent = listViewSkin.getPopupContent();
+ popupContent.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
+ if(event.getCode() == KeyCode.ENTER || event.getCode() == KeyCode.SPACE) {
+ chooseBrowsedItem = true;
+ }
+ });
+ //Checked on the press, as the list closes in a release filter of its own that runs before one added here
+ popupContent.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
+ for(Node node = event.getPickResult().getIntersectedNode(); node != null && node != popupContent; node = node.getParent()) {
+ if(node instanceof ListCell<?> cell) {
+ chooseBrowsedItem = !cell.isEmpty();
+ break;
+ }
+ }
+ });
+ }
+ };
+ if(combo.getSkin() != null) {
+ addChooseFilters.accept(combo.getSkin());
+ }
+ combo.skinProperty().addListener((observable, oldSkin, skin) -> addChooseFilters.accept(skin));
+ }
+
public ComboBox<?> getComboProperty() {
return comboProperty.get();
}
### src/main/java/com/sparrowwallet/sparrow/control/PrivateKeySweepDialog.java
@@ -152,6 +152,7 @@ public ScriptType fromString(String string) {
toAddress.getStyleClass().add("fixed-width");
toAddress.setSkin(new AddressTextFieldSkin(toAddress));
toWallet = new ComboBox<>();
+ toWallet.setAccessibleText("Choose a wallet to sweep to");
toWallet.setItems(FXCollections.observableList(AppServices.get().getOpenWallets().keySet().stream()
.filter(w -> !w.isWhirlpoolChildWallet() && !w.isBip47()).collect(Collectors.toList())));
toAddress.setComboProperty(toWallet);
@@ -227,7 +228,7 @@ public ScriptType fromString(String string) {
createButton.setDisable(!isValidKey() || !isValidToAddress());
});
- toWallet.valueProperty().addListener((observable, oldValue, selectedWallet) -> {
+ toAddress.<Wallet>setOnChoose(selectedWallet -> {
if(selectedWallet != null) {
if(selectedWallet.getPolicyType() == PolicyType.SINGLE_SP) {
toAddress.setText(selectedWallet.getSilentPaymentScanAddress().getSilentPaymentAddress().getAddress());
### src/main/java/com/sparrowwallet/sparrow/settings/ServerSettingsController.java
@@ -291,7 +291,7 @@ public void initializeView(Config config) {
recentCoreServers.setCellFactory(value -> new ServerCell());
recentCoreServers.setItems(getObservableServerList(Config.get().getRecentCoreServers()));
recentCoreServers.prefWidthProperty().bind(coreHost.widthProperty());
- recentCoreServers.valueProperty().addListener((observable, oldValue, newValue) -> {
+ coreHost.<Server>setOnChoose(newValue -> {
if(newValue != null) {
if(newValue == MANAGE_ALIASES_SERVER) {
ServerAliasDialog serverAliasDialog = new ServerAliasDialog(ServerType.BITCOIN_CORE);
@@ -337,7 +337,7 @@ public void initializeView(Config config) {
recentElectrumServers.setCellFactory(value -> new ServerCell());
recentElectrumServers.setItems(getObservableServerList(Config.get().getRecentElectrumServers()));
recentElectrumServers.prefWidthProperty().bind(electrumHost.widthProperty());
- recentElectrumServers.valueProperty().addListener((observable, oldValue, newValue) -> {
+ electrumHost.<Server>setOnChoose(newValue -> {
if(newValue != null) {
if(newValue == MANAGE_ALIASES_SERVER) {
ServerAliasDialog serverAliasDialog = new ServerAliasDialog(ServerType.ELECTRUM_SERVER);
### src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java
@@ -38,6 +38,7 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
+import javafx.scene.AccessibleRole;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.control.DateCell;
@@ -504,6 +505,8 @@ public LocalDate fromString(String value) {
broadcastProgressBar.managedProperty().bind(broadcastProgressBar.visibleProperty());
broadcastProgressBar.visibleProperty().bind(signaturesProgressBar.visibleProperty().not());
blockStatus.accessibleTextProperty().bind(Bindings.concat("Transaction status: ", blockStatus.textProperty()));
+ //A read-only text field rather than text, as VoiceOver keeps reading the first value it saw of text that later changes
+ blockStatus.setAccessibleRole(AccessibleRole.TEXT_FIELD);
broadcastButton.managedProperty().bind(broadcastButton.visibleProperty());
showTransactionButton.managedProperty().bind(showTransactionButton.visibleProperty());
### src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java
@@ -51,12 +51,8 @@
import javafx.scene.AccessibleRole;
import javafx.scene.Node;
import javafx.scene.control.*;
-import javafx.scene.control.skin.ComboBoxListViewSkin;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
-import javafx.scene.input.KeyCode;
-import javafx.scene.input.KeyEvent;
-import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import org.controlsfx.glyphfont.Glyph;
@@ -89,9 +85,6 @@ public class PaymentController extends WalletFormController implements Initializ
@FXML
private ComboBox<Wallet> openWallets;
- private Wallet browsedWallet;
- private boolean chooseBrowsedWallet;
-
@FXML
private ComboBoxTextField address;
@@ -313,24 +306,7 @@ public void setSendController(SendController sendController) {
public void initializeView() {
updateOpenWallets();
openWallets.prefWidthProperty().bind(address.widthProperty());
- //While the list is open the value follows the highlighted wallet, so a wallet is only chosen once the list closes
- openWallets.valueProperty().addListener((observable, oldValue, newValue) -> {
- if(!openWallets.isShowing()) {
- selectOpenWallet(newValue);
- } else if(newValue != null) {
- browsedWallet = newValue;
- }
- });
- //Only Enter, Space or a click on a wallet chooses it; closing the list any other way leaves the browsed wallet unchosen
- openWallets.setOnHidden(event -> {
- Wallet wallet = chooseBrowsedWallet ? browsedWallet : null;
- browsedWallet = null;
- chooseBrowsedWallet = false;
- Platform.runLater(() -> openWallets.getSelectionModel().clearSelection());
- if(wallet != null) {
- selectOpenWallet(wallet);
- }
- });
+ address.setOnChoose(this::selectOpenWallet);
openWallets.setCellFactory(c -> new ListCell<>() {
@Override
protected void updateItem(Wallet wallet, boolean empty) {
@@ -344,32 +320,6 @@ protected void updateItem(Wallet wallet, boolean empty) {
}
}
});
- //Choosing a wallet fills the address and moves on to the label, so arrow keys open the list to browse rather than choosing the next wallet
- openWallets.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
- if((event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN) && !openWallets.isShowing()) {
- openWallets.show();
- event.consume();
- }
- });
- openWallets.skinProperty().addListener((observable, oldSkin, skin) -> {
- if(skin instanceof ComboBoxListViewSkin<?> listViewSkin) {
- Node popupContent = listViewSkin.getPopupContent();
- popupContent.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
- if(event.getCode() == KeyCode.ENTER || event.getCode() == KeyCode.SPACE) {
- chooseBrowsedWallet = true;
- }
- });
- //Checked on the press, as the list closes in a release filter of its own that runs before one added here
- popupContent.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
- for(Node node = event.getPickResult().getIntersectedNode(); node != null && node != popupContent; node = node.getParent()) {
- if(node instanceof ListCell<?> cell) {
- chooseBrowsedWallet = !cell.isEmpty();
- break;
- }
- }
- });
- }
- });
openWallets.setOnShowing(event -> {
if(!openWallets.getItems().contains(nfcCardWallet) && CardApi.isReaderAvailable()) {
openWallets.getItems().add(nfcCardWallet);
### src/main/resources/com/sparrowwallet/sparrow/settings/server.fxml
@@ -101,7 +101,7 @@
<Fieldset inputGrow="SOMETIMES" text="Bitcoin Core RPC">
<Field text="URL:">
<StackPane>
- <ComboBox fx:id="recentCoreServers" />
+ <ComboBox fx:id="recentCoreServers" accessibleText="Choose a recent server" />
<ComboBoxTextField fx:id="coreHost" promptText="e.g. 127.0.0.1" comboProperty="$recentCoreServers" />
</StackPane>
<TextField fx:id="corePort" promptText="e.g. 8332" maxWidth="120" />
@@ -151,7 +151,7 @@
<Fieldset inputGrow="SOMETIMES" text="Private Electrum Server">
<Field text="URL:">
<StackPane>
- <ComboBox fx:id="recentElectrumServers" />
+ <ComboBox fx:id="recentElectrumServers" accessibleText="Choose a recent server" />
<ComboBoxTextField fx:id="electrumHost" promptText="e.g. 127.0.0.1 or Tor hostname (.onion)" comboProperty="$recentElectrumServers" />
</StackPane>
<TextField fx:id="electrumPort" promptText="e.g. 50001" maxWidth="120" />Why this scored 15/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.