focus the first device found when scanning in the import wallet dialog, report when none are found and read the status for each pane
What changed, and why it matters
This commit improves the user experience of importing a wallet from a hardware device. It focuses the first device found during a scan, shows a warning if no devices are found, and improves accessibility text for screen readers. There is no security issue here.
No security action required. This is a routine UX/accessibility improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies two UI classes. TitledDescriptionPane now dynamically binds accessibleTextProperty to include both the title and description labels, improving screen-reader announcements. WalletImportDialog promotes a local ScrollPane to a field so it can scroll to the top and focus the first accordion pane after a successful hardware wallet scan; it also adds user-facing warning and error dialogs when no devices are found or when scanning fails. These are UX/accessibility enhancements with no security-relevant code changes.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/TitledDescriptionPane.javasrc/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.javaInspect captured patch +15 / −2
### src/main/java/com/sparrowwallet/sparrow/control/TitledDescriptionPane.java
@@ -6,6 +6,7 @@
import com.sparrowwallet.sparrow.AppServices;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
+import javafx.beans.binding.Bindings;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
@@ -26,10 +27,11 @@ public class TitledDescriptionPane extends TitledPane {
public TitledDescriptionPane(String title, String description, String content, WalletModel walletModel) {
getStylesheets().add(AppServices.class.getResource("general.css").toExternalForm());
getStyleClass().add("titled-description-pane");
- setAccessibleText(title);
setPadding(Insets.EMPTY);
setGraphic(getTitle(title, description, walletModel));
+ accessibleTextProperty().bind(Bindings.createStringBinding(() -> descriptionLabel.getText() == null || descriptionLabel.getText().isEmpty() ?
+ mainLabel.getText() : mainLabel.getText() + ", " + descriptionLabel.getText(), mainLabel.textProperty(), descriptionLabel.textProperty()));
setContent(getContentBox(content));
removeArrow();
}
### src/main/java/com/sparrowwallet/sparrow/control/WalletImportDialog.java
@@ -24,6 +24,7 @@
public class WalletImportDialog extends Dialog<List<Wallet>> {
private List<Wallet> wallets;
private final Accordion importAccordion;
+ private final ScrollPane scrollPane;
private final Button scanButton;
public WalletImportDialog(List<WalletForm> selectedWalletForms) {
@@ -43,7 +44,7 @@ public WalletImportDialog(List<WalletForm> selectedWalletForms) {
AnchorPane anchorPane = new AnchorPane();
stackPane.getChildren().add(anchorPane);
- ScrollPane scrollPane = new ScrollPane();
+ scrollPane = new ScrollPane();
scrollPane.setPrefHeight(520);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
anchorPane.getChildren().add(scrollPane);
@@ -117,12 +118,22 @@ private void scan() {
importAccordion.getPanes().add(0, devicePane);
}
Platform.runLater(() -> EventManager.get().post(new UsbDeviceEvent(devices)));
+
+ if(devices.isEmpty()) {
+ AppServices.showWarningDialog("No hardware wallets found", "Check that the device is connected and unlocked, then scan again.");
+ } else {
+ Platform.runLater(() -> {
+ scrollPane.setVvalue(scrollPane.getVmin());
+ importAccordion.getPanes().getFirst().requestFocus();
+ });
+ }
});
enumerateService.setOnFailed(workerStateEvent -> {
Glyph glyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EXCLAMATION_CIRCLE);
glyph.getStyleClass().add("failure");
scanButton.setGraphic(glyph);
scanButton.setTooltip(new Tooltip(workerStateEvent.getSource().getException().getMessage()));
+ AppServices.showErrorDialog("Could not scan for hardware wallets", workerStateEvent.getSource().getException().getMessage());
});
enumerateService.start();
}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.