remove unnamed and hidden tab stops and expose code areas to screen readers
What changed, and why it matters
This commit improves accessibility for users who navigate the wallet with a keyboard or screen reader. It removes hidden or unnamed keyboard stops, makes read-only code areas (like transaction hex and wallet descriptors) readable by assistive technology, and improves how labels are spoken aloud. There is no security vulnerability or exploit here.
No security action required. Treat as a normal accessibility improvement; review for UI/UX regression if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is an accessibility/usability fix. It introduces a ReadOnlyCodeArea subclass of RichTextFX CodeArea that exposes AccessibleRole.TEXT_AREA, reports TEXT and EDITABLE attributes, suppresses styled-text CHILDREN, and moves focus on Tab. DescriptorArea, ScriptArea, SelectableCodeArea, and TransactionHexArea are migrated to this new base class. CopyableLabel now sets an :empty pseudo-class so empty labels are not focus-traversable. SelectedTabSkin hides tab panes with invisible headers from the Tab order. SettingsController combines two multisig labels into one and binds accessibleText to a screen-reader-friendly ‘M of N’ string. FXML and CSS changes mark statusBar and MasterDetailPane as focusTraversable=false. No cryptographic, network, or input-validation logic is changed.
Changed components
CopyableLabel controlReadOnlyCodeArea controlDescriptorArea controlScriptArea controlSelectableCodeArea controlTransactionHexArea controlSelectedTabSkin tab pane skinSettingsControllerapp.fxml status bartransaction.fxml MasterDetailPanewallet/transactions.fxml MasterDetailPanewallet/settings.fxml multisig labelInspect captured patch +65 / −36
### src/main/java/com/sparrowwallet/sparrow/control/CopyableLabel.java
@@ -1,11 +1,16 @@
package com.sparrowwallet.sparrow.control;
import javafx.collections.FXCollections;
+import javafx.css.PseudoClass;
import javafx.scene.AccessibleAttribute;
import javafx.scene.AccessibleRole;
import javafx.scene.control.TextField;
public class CopyableLabel extends TextField {
+ //Styled out of the Tab order while empty. Leaving the empty state resets focus traversability to the default, so a label that sets it
+ //itself keeps that setting only while it is never empty in the scene
+ private static final PseudoClass EMPTY = PseudoClass.getPseudoClass("empty");
+
public CopyableLabel() {
this("");
}
@@ -16,7 +21,9 @@ public CopyableLabel(String text) {
this.setEditable(false);
this.getStyleClass().add("copyable-label");
this.setPrefWidth(10);
+ pseudoClassStateChanged(EMPTY, text == null || text.isEmpty());
this.textProperty().addListener((ob, o, n) -> {
+ pseudoClassStateChanged(EMPTY, n == null || n.isEmpty());
// expand the textfield
double width = TextUtils.computeTextWidth(this.getFont(), this.getText(), 0.0D) + 2;
this.setPrefWidth(width);
### src/main/java/com/sparrowwallet/sparrow/control/DescriptorArea.java
@@ -6,25 +6,19 @@
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.Wallet;
-import com.sparrowwallet.sparrow.AppServices;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
-import org.fxmisc.richtext.CodeArea;
import java.util.List;
import static com.sparrowwallet.drongo.policy.PolicyType.*;
import static com.sparrowwallet.drongo.protocol.ScriptType.MULTISIG;
-public class DescriptorArea extends CodeArea {
+public class DescriptorArea extends ReadOnlyCodeArea {
private Wallet wallet;
- public DescriptorArea() {
- AppServices.moveFocusOnTab(this);
- }
-
public void setWallet(Wallet wallet) {
clear();
this.wallet = wallet;
### src/main/java/com/sparrowwallet/sparrow/control/LabelledFieldSkin.java
@@ -52,7 +52,7 @@ private Node getLabelledInput(List<Node> inputs) {
//Only value controls are labelled: a button or a value shown in a plain label after the field label is not what the label names
private Node findInput(List<Node> nodes, boolean textInputOnly) {
for(Node node : nodes) {
- boolean input = node instanceof TextInputControl || (!textInputOnly && isValueControl(node));
+ boolean input = node instanceof TextInputControl || node instanceof ReadOnlyCodeArea || (!textInputOnly && isValueControl(node));
if(input || (!(node instanceof Control) && node instanceof Parent)) {
watchVisibility(node);
}
### src/main/java/com/sparrowwallet/sparrow/control/ReadOnlyCodeArea.java
@@ -0,0 +1,31 @@
+package com.sparrowwallet.sparrow.control;
+
+import com.sparrowwallet.sparrow.AppServices;
+import javafx.collections.FXCollections;
+import javafx.scene.AccessibleAttribute;
+import javafx.scene.AccessibleRole;
+import org.fxmisc.richtext.CodeArea;
+
+/**
+ * Code area for displaying descriptors, scripts and transactions. RichTextFX areas expose nothing to screen readers, so focus on
+ * one is silent; this one is read as a read-only text area holding its text, and Tab moves focus on rather than being swallowed.
+ */
+public class ReadOnlyCodeArea extends CodeArea {
+ public ReadOnlyCodeArea() {
+ setAccessibleRole(AccessibleRole.TEXT_AREA);
+ AppServices.moveFocusOnTab(this);
+ //Text changes only: the text property is also invalidated by style changes, and reading it rebuilds the whole text
+ plainTextChanges().subscribe(_ -> notifyAccessibleAttributeChanged(AccessibleAttribute.TEXT));
+ }
+
+ @Override
+ public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) {
+ return switch(attribute) {
+ case TEXT -> getText();
+ case EDITABLE -> isEditable();
+ //The styled text segments would otherwise be read as separate pieces of text
+ case CHILDREN -> FXCollections.emptyObservableList();
+ default -> super.queryAccessibleAttribute(attribute, parameters);
+ };
+ }
+}
### src/main/java/com/sparrowwallet/sparrow/control/ScriptArea.java
@@ -3,21 +3,15 @@
import com.sparrowwallet.drongo.protocol.Script;
import com.sparrowwallet.drongo.protocol.ScriptChunk;
import com.sparrowwallet.drongo.protocol.ScriptOpCodes;
-import com.sparrowwallet.sparrow.AppServices;
import javafx.geometry.Pos;
import org.controlsfx.control.decoration.Decorator;
import org.controlsfx.control.decoration.GraphicDecoration;
-import org.fxmisc.richtext.CodeArea;
import static com.sparrowwallet.drongo.protocol.ScriptType.*;
-public class ScriptArea extends CodeArea {
+public class ScriptArea extends ReadOnlyCodeArea {
private Script script;
- public ScriptArea() {
- AppServices.moveFocusOnTab(this);
- }
-
public void appendScript(Script script) {
appendScript(script, null, null);
}
### src/main/java/com/sparrowwallet/sparrow/control/SelectableCodeArea.java
@@ -1,16 +1,13 @@
package com.sparrowwallet.sparrow.control;
-import com.sparrowwallet.sparrow.AppServices;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
-import org.fxmisc.richtext.CodeArea;
-public class SelectableCodeArea extends CodeArea {
+public class SelectableCodeArea extends ReadOnlyCodeArea {
public SelectableCodeArea() {
super();
- AppServices.moveFocusOnTab(this);
ContextMenu contextMenu = new ContextMenu();
MenuItem copy = new MenuItem("Copy");
### src/main/java/com/sparrowwallet/sparrow/control/SelectedTabSkin.java
@@ -7,11 +7,19 @@
/**
* Tab pane skin that tells screen readers when the selected tab changes. JavaFX only notifies the tab pane, so VoiceOver keeps reading
- * every tab it has seen selected as selected. Applied to every tab pane with -fx-skin in app.css.
+ * every tab it has seen selected as selected. Also leaves a tab pane with hidden headers out of the Tab order.
+ * Applied to every tab pane with -fx-skin in app.css.
*/
public class SelectedTabSkin extends TabPaneSkin {
public SelectedTabSkin(TabPane tabPane) {
super(tabPane);
+ //A tab pane whose tab headers are hidden (a single account or payment) is not a Tab stop, as it would focus a tab that cannot be seen
+ for(Node child : getChildren()) {
+ if(child.getStyleClass().contains("tab-header-area")) {
+ child.visibleProperty().addListener((_, _, visible) -> tabPane.setFocusTraversable(visible));
+ tabPane.setFocusTraversable(child.isVisible());
+ }
+ }
registerChangeListener(tabPane.getSelectionModel().selectedItemProperty(), _ -> {
for(Node child : getChildren()) {
if(child.getStyleClass().contains("tab-header-area")) {
### src/main/java/com/sparrowwallet/sparrow/control/TransactionHexArea.java
@@ -2,7 +2,6 @@
import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.protocol.*;
-import com.sparrowwallet.sparrow.AppServices;
import javafx.application.Platform;
import javafx.geometry.Point2D;
import javafx.scene.control.ContextMenu;
@@ -12,7 +11,6 @@
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.stage.Popup;
-import org.fxmisc.richtext.CodeArea;
import org.fxmisc.richtext.event.MouseOverTextEvent;
import org.fxmisc.richtext.model.StyleSpan;
@@ -23,7 +21,7 @@
import static org.fxmisc.richtext.model.TwoDimensional.Bias.Backward;
-public class TransactionHexArea extends CodeArea {
+public class TransactionHexArea extends ReadOnlyCodeArea {
private static final int TRUNCATE_AT = 30000;
private static final int SEGMENTS_INTERVAL = 250;
@@ -32,7 +30,6 @@ public class TransactionHexArea extends CodeArea {
public TransactionHexArea() {
super();
- AppServices.moveFocusOnTab(this);
addPopupHandler();
}
### src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java
@@ -24,6 +24,7 @@
import com.sparrowwallet.sparrow.net.ElectrumServer;
import com.sparrowwallet.sparrow.net.ServerType;
import javafx.application.Platform;
+import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.collections.FXCollections;
import javafx.event.ActionEvent;
@@ -83,10 +84,7 @@ public class SettingsController extends WalletFormController implements Initiali
private RangeSlider multisigControl;
@FXML
- private CopyableLabel multisigLowLabel;
-
- @FXML
- private CopyableLabel multisigHighLabel;
+ private CopyableLabel multisigLabel;
@FXML
private StackPane keystoreTabsPane;
@@ -192,8 +190,9 @@ public ScriptType fromString(String string) {
EventManager.get().post(new SettingsChangedEvent(walletForm.getWallet(), SettingsChangedEvent.Type.SCRIPT_TYPE));
});
- multisigLowLabel.textProperty().bind(multisigControl.lowValueProperty().asString("%.0f") );
- multisigHighLabel.textProperty().bind(multisigControl.highValueProperty().asString("%.0f"));
+ multisigLabel.textProperty().bind(Bindings.format("%.0f / %.0f", multisigControl.lowValueProperty(), multisigControl.highValueProperty()));
+ //Spoken as "2 of 3" rather than with a slash
+ multisigLabel.accessibleTextProperty().bind(Bindings.format("%.0f of %.0f", multisigControl.lowValueProperty(), multisigControl.highValueProperty()));
multisigControl.lowValueProperty().addListener((observable, oldValue, threshold) -> {
EventManager.get().post(new SettingsChangedEvent(walletForm.getWallet(), SettingsChangedEvent.Type.MUTLISIG_THRESHOLD));
### src/main/resources/com/sparrowwallet/sparrow/app.fxml
@@ -185,7 +185,7 @@
<TabPane fx:id="tabs" />
</DecorationPane>
- <StatusBar fx:id="statusBar" text="" minHeight="36">
+ <StatusBar fx:id="statusBar" text="" minHeight="36" focusTraversable="false">
<rightItems>
<UnlabeledToggleSwitch fx:id="serverToggle" accessibleText="Server connection">
<tooltip>
### src/main/resources/com/sparrowwallet/sparrow/general.css
@@ -5,6 +5,10 @@
-fx-padding: 5 0 5 0;
}
+.copyable-label:empty {
+ -fx-focus-traversable: false;
+}
+
.form .wideLabelFieldSet.fieldset:horizontal .label-container {
-fx-pref-width: 170px;
-fx-pref-height: 25px;
### src/main/resources/com/sparrowwallet/sparrow/transaction/transaction.fxml
@@ -8,7 +8,7 @@
<SplitPane fx:id="tabContent" dividerPositions="0.82" orientation="VERTICAL" stylesheets="@transaction.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.TransactionController">
<items>
- <MasterDetailPane fx:id="transactionMasterDetail" detailSide="BOTTOM">
+ <MasterDetailPane fx:id="transactionMasterDetail" detailSide="BOTTOM" focusTraversable="false">
<masterNode>
<SplitPane fx:id="txSplitPane" dividerPositions="0.15">
<items>
### src/main/resources/com/sparrowwallet/sparrow/wallet/settings.fxml
@@ -68,9 +68,7 @@
<CosignersSlider fx:id="multisigControl" showTickMarks="true" showTickLabels="true" blockIncrement="1" min="1" max="9" highValue="3" lowValue="2" snapToTicks="true" majorTickUnit="1" minorTickCount="0" />
</Field>
<Field text="M of N:">
- <CopyableLabel fx:id="multisigLowLabel" />
- <CopyableLabel text="/"/>
- <CopyableLabel fx:id="multisigHighLabel" />
+ <CopyableLabel fx:id="multisigLabel" />
</Field>
</Fieldset>
</Form>
### src/main/resources/com/sparrowwallet/sparrow/wallet/transactions.fxml
@@ -62,7 +62,7 @@
</yAxis>
</BalanceChart>
</GridPane>
- <MasterDetailPane fx:id="transactionsMasterDetail" detailSide="BOTTOM" VBox.vgrow="ALWAYS">
+ <MasterDetailPane fx:id="transactionsMasterDetail" detailSide="BOTTOM" VBox.vgrow="ALWAYS" focusTraversable="false">
<masterNode>
<TransactionsTreeTable fx:id="transactionsTable" tableType="TRANSACTIONS" />
</masterNode>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.