expose action buttons built from toggle buttons to screen readers as buttons instead of checkboxes
What changed, and why it matters
This commit is an accessibility fix. It tells screen-reader software (used by visually impaired people) to announce certain on-screen controls as regular buttons rather than as checkboxes/toggle switches. The buttons themselves already looked and behaved like action buttons; only the screen-reader description was wrong. There is no direct security vulnerability in the code change.
No security action required. Treat as a normal accessibility/usability improvement. If desired, verify with a screen reader that the controls are now announced as buttons.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch sets AccessibleRole.BUTTON on ToggleButton instances that are used inside SegmentedButton controls for actions such as copy, open block explorer, show/scan QR, save/load PSBT, change PIN, backup card, and select keystore source. Previously JavaFX would expose these ToggleButtons with their default toggle/checkbox role to assistive technologies, which is semantically misleading because they trigger one-off actions rather than persisting a state. The change is purely a UI accessibility annotation and does not alter event handlers, business logic, cryptography, or network behavior.
Changed components
File import UI (FileImportPane.java)Keystore export UI (FileKeystoreExportPane.java)Wallet export UI (FileWalletExportPane.java)Transaction headers FXML (headers.fxml)Keystore FXML (keystore.fxml)Inspect captured patch +18 / −12
### src/main/java/com/sparrowwallet/sparrow/control/FileImportPane.java
@@ -15,6 +15,7 @@
import javafx.beans.property.SimpleStringProperty;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
+import javafx.scene.AccessibleRole;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBase;
@@ -77,6 +78,7 @@ protected Control createButton() {
SegmentedButton segmentedButton = new SegmentedButton();
segmentedButton.getButtons().addAll(scanButton, fileButton);
+ segmentedButton.getButtons().forEach(button -> button.setAccessibleRole(AccessibleRole.BUTTON));
return segmentedButton;
} else if(scannable) {
importButton = new Button("Scan...");
### src/main/java/com/sparrowwallet/sparrow/control/FileKeystoreExportPane.java
@@ -13,6 +13,7 @@
import com.sparrowwallet.sparrow.io.bbqr.BBQR;
import com.sparrowwallet.sparrow.io.bbqr.BBQRType;
import javafx.geometry.Pos;
+import javafx.scene.AccessibleRole;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Control;
@@ -68,6 +69,7 @@ protected Control createButton() {
SegmentedButton segmentedButton = new SegmentedButton();
segmentedButton.getButtons().addAll(showButton, fileButton);
+ segmentedButton.getButtons().forEach(button -> button.setAccessibleRole(AccessibleRole.BUTTON));
return segmentedButton;
} else if(scannable) {
Button showButton = new Button("Show...");
### src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java
@@ -19,6 +19,7 @@
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
+import javafx.scene.AccessibleRole;
import javafx.scene.control.Button;
import javafx.scene.control.Control;
import javafx.scene.control.ToggleButton;
@@ -72,6 +73,7 @@ protected Control createButton() {
SegmentedButton segmentedButton = new SegmentedButton();
segmentedButton.getButtons().addAll(showButton, fileButton);
+ segmentedButton.getButtons().forEach(button -> button.setAccessibleRole(AccessibleRole.BUTTON));
return segmentedButton;
} else if(scannable) {
Button showButton = new Button("Show...");
### src/main/resources/com/sparrowwallet/sparrow/transaction/headers.fxml
@@ -50,15 +50,15 @@
<IdLabel fx:id="id"/>
<SegmentedButton>
<buttons>
- <ToggleButton fx:id="copyTxid" onAction="#copyId">
+ <ToggleButton accessibleRole="BUTTON" fx:id="copyTxid" onAction="#copyId">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="COPY" />
</graphic>
<tooltip>
<Tooltip text="Copy the transaction id to the clipboard"/>
</tooltip>
</ToggleButton>
- <ToggleButton fx:id="openBlockExplorer" onAction="#openInBlockExplorer">
+ <ToggleButton accessibleRole="BUTTON" fx:id="openBlockExplorer" onAction="#openInBlockExplorer">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="UP_RIGHT_FROM_SQUARE" />
</graphic>
@@ -279,12 +279,12 @@
<HBox fx:id="signButtonBox" styleClass="signatures-buttons" spacing="20">
<SegmentedButton HBox.hgrow="ALWAYS">
<buttons>
- <ToggleButton HBox.hgrow="ALWAYS" text="Show QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#showPSBT">
+ <ToggleButton accessibleRole="BUTTON" HBox.hgrow="ALWAYS" text="Show QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#showPSBT">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="QRCODE" />
</graphic>
</ToggleButton>
- <ToggleButton HBox.hgrow="ALWAYS" text="Scan QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#scanPSBT">
+ <ToggleButton accessibleRole="BUTTON" HBox.hgrow="ALWAYS" text="Scan QR" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#scanPSBT">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="CAMERA" />
</graphic>
@@ -293,12 +293,12 @@
</SegmentedButton>
<SegmentedButton HBox.hgrow="ALWAYS">
<buttons>
- <ToggleButton HBox.hgrow="ALWAYS" text="Save Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#savePSBT">
+ <ToggleButton accessibleRole="BUTTON" HBox.hgrow="ALWAYS" text="Save Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#savePSBT">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SD_CARD" />
</graphic>
</ToggleButton>
- <ToggleButton HBox.hgrow="ALWAYS" text="Load Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#loadPSBT">
+ <ToggleButton accessibleRole="BUTTON" HBox.hgrow="ALWAYS" text="Load Transaction" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" onAction="#loadPSBT">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="ARROW_UP" />
</graphic>
### src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml
@@ -46,15 +46,15 @@
<ToggleGroup fx:id="cardServiceToggleGroup" />
</toggleGroup>
<buttons>
- <ToggleButton toggleGroup="$cardServiceToggleGroup" text="Change Pin" graphicTextGap="5" onAction="#changeCardPin">
+ <ToggleButton accessibleRole="BUTTON" toggleGroup="$cardServiceToggleGroup" text="Change Pin" graphicTextGap="5" onAction="#changeCardPin">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="WIFI" />
</graphic>
<tooltip>
<Tooltip text="Change the PIN of the current card"/>
</tooltip>
</ToggleButton>
- <ToggleButton fx:id="backupButton" toggleGroup="$cardServiceToggleGroup" text="Backup" onAction="#backupCard">
+ <ToggleButton accessibleRole="BUTTON" fx:id="backupButton" toggleGroup="$cardServiceToggleGroup" text="Backup" onAction="#backupCard">
<tooltip>
<Tooltip text="Backup the current card"/>
</tooltip>
@@ -120,31 +120,31 @@
<ToggleGroup fx:id="keystoreSourceToggleGroup" />
</toggleGroup>
<buttons>
- <ToggleButton text="Connected Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
+ <ToggleButton accessibleRole="BUTTON" text="Connected Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
<graphic>
<Glyph fontFamily="Font Awesome 5 Brands Regular" fontSize="20" icon="USB" />
</graphic>
<userData>
<KeystoreSource fx:constant="HW_USB"/>
</userData>
</ToggleButton>
- <ToggleButton text="Airgapped Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
+ <ToggleButton accessibleRole="BUTTON" text="Airgapped Hardware Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SD_CARD" />
</graphic>
<userData>
<KeystoreSource fx:constant="HW_AIRGAPPED"/>
</userData>
</ToggleButton>
- <ToggleButton text="New or Imported Software Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
+ <ToggleButton accessibleRole="BUTTON" text="New or Imported Software Wallet" contentDisplay="TOP" wrapText="true" textAlignment="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="LAPTOP" />
</graphic>
<userData>
<KeystoreSource fx:constant="SW_SEED"/>
</userData>
</ToggleButton>
- <ToggleButton contentDisplay="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
+ <ToggleButton accessibleRole="BUTTON" contentDisplay="CENTER" toggleGroup="$keystoreSourceToggleGroup" onAction="#selectSource">
<graphic>
<Label text="Watch Only Wallet" wrapText="true" textAlignment="CENTER" maxWidth="90" contentDisplay="TOP">
<graphic>Why this scored 19/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.