name the paynym dialog fields, lists, contact rows and buttons, and hide the avatars from screen readers
What changed, and why it matters
This commit improves accessibility for users who rely on screen readers. It adds readable names to buttons, contact list rows, and form fields in the PayNym dialog, and hides decorative avatar images from assistive technology. There is no security vulnerability or exploit here.
No security action required. Treat as a normal accessibility improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is an accessibility hardening change in the PayNym UI. It switches PayNymAvatar from StackPane to DecorativePane (presumably a custom non-accessible pane), sets accessibleText on list cells and buttons, links Labels to their associated controls via setLabelFor(), and assigns fx:ids to labels in the FXML so they can be referenced from the controller. No cryptographic, network, or privilege-related code is modified.
Changed components
PayNym dialog UI (paynym.fxml)PayNymControllerPayNymCell list cell rendererPayNymAvatar controlInspect captured patch +37 / −14
### src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java
@@ -12,7 +12,6 @@
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.scene.image.Image;
-import javafx.scene.layout.StackPane;
import javafx.scene.paint.ImagePattern;
import javafx.scene.shape.Circle;
import org.slf4j.Logger;
@@ -25,7 +24,7 @@
import java.util.HashMap;
import java.util.Map;
-public class PayNymAvatar extends StackPane {
+public class PayNymAvatar extends DecorativePane {
private static final Logger log = LoggerFactory.getLogger(PayNymAvatar.class);
private final ObjectProperty<PaymentCode> paymentCodeProperty = new SimpleObjectProperty<>(null);
### src/main/java/com/sparrowwallet/sparrow/control/PayNymCell.java
@@ -41,6 +41,7 @@ protected void updateItem(PayNym payNym, boolean empty) {
if(empty || payNym == null) {
setText(null);
setGraphic(null);
+ setAccessibleText(null);
} else {
BorderPane pane = new BorderPane();
pane.setPadding(new Insets(5, 5,5, 5));
@@ -57,10 +58,12 @@ protected void updateItem(PayNym payNym, boolean empty) {
labelBox.getChildren().add(label);
pane.setLeft(labelBox);
+ boolean linked = false;
if(getListView().getUserData() == Boolean.TRUE || (!contact && payNymController != null && payNymController.isFollowing(payNym) == Boolean.FALSE)) {
HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER);
Button button = new Button("Add Contact");
+ button.setAccessibleText("Add Contact " + payNym.nymName());
hBox.getChildren().add(button);
pane.setRight(hBox);
button.setOnAction(event -> {
@@ -72,12 +75,14 @@ protected void updateItem(PayNym payNym, boolean empty) {
hBox.setAlignment(Pos.CENTER);
pane.setRight(hBox);
- if(payNymController.isLinked(payNym)) {
+ linked = payNymController.isLinked(payNym);
+ if(linked) {
Label linkedLabel = new Label("Linked", getLinkGlyph());
linkedLabel.setTooltip(new Tooltip("You can send non-collaboratively to this contact."));
hBox.getChildren().add(linkedLabel);
} else {
Button linkButton = new Button("Link Contact", getLinkGlyph());
+ linkButton.setAccessibleText("Link Contact " + payNym.nymName());
linkButton.setTooltip(new Tooltip("Create a transaction that will enable you to send non-collaboratively to this contact."));
hBox.getChildren().add(linkButton);
linkButton.setOnAction(event -> {
@@ -90,12 +95,9 @@ protected void updateItem(PayNym payNym, boolean empty) {
setText(null);
setGraphic(pane);
-
- if(contact && payNymController != null && payNymController.isLinked(payNym)) {
- setContextMenu(new PayNymCellContextMenu(payNym));
- } else {
- setContextMenu(null);
- }
+ //The name is drawn in the graphic, so the row is named after the contact, and whether it is linked, for screen readers
+ setAccessibleText(payNym.nymName() + (linked ? ", linked" : ""));
+ setContextMenu(linked ? new PayNymCellContextMenu(payNym) : null);
}
}
### src/main/java/com/sparrowwallet/sparrow/paynym/PayNymController.java
@@ -80,6 +80,21 @@ public class PayNymController {
@FXML
private ListView<PayNym> followersList;
+ @FXML
+ private Label payNymNameLabel;
+
+ @FXML
+ private Label paymentCodeLabel;
+
+ @FXML
+ private Label searchPayNymsLabel;
+
+ @FXML
+ private Label followingLabel;
+
+ @FXML
+ private Label followersLabel;
+
private final ObjectProperty<PayNym> payNymProperty = new SimpleObjectProperty<>(null);
private final StringProperty findNymProperty = new SimpleStringProperty();
@@ -91,6 +106,13 @@ public class PayNymController {
public void initializeView(String walletId) {
this.walletId = walletId;
+ //The labels sit beside their controls rather than in form fields, so they are linked here to name the controls for screen readers
+ payNymNameLabel.setLabelFor(payNymName);
+ paymentCodeLabel.setLabelFor(paymentCode);
+ searchPayNymsLabel.setLabelFor(searchPayNyms);
+ followingLabel.setLabelFor(followingList);
+ followersLabel.setLabelFor(followersList);
+
payNymName.managedProperty().bind(payNymName.visibleProperty());
payNymRetrieve.managedProperty().bind(payNymRetrieve.visibleProperty());
payNymRetrieve.visibleProperty().bind(payNymName.visibleProperty().not());
### src/main/resources/com/sparrowwallet/sparrow/paynym/paynym.fxml
@@ -28,7 +28,7 @@
<center>
<VBox spacing="15">
<HBox styleClass="field-box">
- <Label text="PayNym:" styleClass="field-label" />
+ <Label fx:id="payNymNameLabel" text="PayNym:" styleClass="field-label" />
<CopyableTextField fx:id="payNymName" promptText="Retrieving..." styleClass="field-control" editable="false"/>
<Button fx:id="payNymRetrieve" text="Retrieve PayNym" graphicTextGap="8" onAction="#retrievePayNym">
<graphic>
@@ -41,7 +41,7 @@
<ProgressIndicator fx:id="retrievePayNymProgress" />
</HBox>
<HBox styleClass="field-box">
- <Label text="Payment code:" styleClass="field-label" />
+ <Label fx:id="paymentCodeLabel" text="Payment code:" styleClass="field-label" />
<HBox spacing="10">
<PaymentCodeTextField fx:id="paymentCode" styleClass="field-control" editable="false"/>
<Button accessibleText="Show QR Code" onAction="#showQR">
@@ -58,7 +58,7 @@
<padding>
<Insets top="35" />
</padding>
- <Label text="Find Contact:" styleClass="field-label" />
+ <Label fx:id="searchPayNymsLabel" text="Find Contact:" styleClass="field-label" />
<HBox spacing="10">
<CopyableTextField fx:id="searchPayNyms" promptText="PayNym or Payment code" styleClass="field-control"/>
<Button accessibleText="Scan QR Code" fx:id="searchPayNymsScan" onAction="#scanQR">
@@ -92,7 +92,7 @@
<BorderPane GridPane.columnIndex="0" GridPane.rowIndex="0">
<top>
<HBox alignment="CENTER_LEFT">
- <Label styleClass="listview-label" text="Contacts"/>
+ <Label fx:id="followingLabel" styleClass="listview-label" text="Contacts"/>
</HBox>
</top>
<center>
@@ -102,7 +102,7 @@
<BorderPane GridPane.columnIndex="1" GridPane.rowIndex="0">
<top>
<HBox alignment="CENTER_LEFT">
- <Label styleClass="listview-label" text="Followers"/>
+ <Label fx:id="followersLabel" styleClass="listview-label" text="Followers"/>
</HBox>
</top>
<center>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.