focus new wallet tabs and announce the cosigners slider counts as they change
What changed, and why it matters
This commit makes two small user-interface improvements for accessibility. When opening a new wallet tab, the keyboard focus now moves to that new tab instead of dropping to the status bar. In the multisig wallet setup, the control for choosing the number of cosigners and required signatures now reports its value to screen readers as a 'spinner' rather than a 'slider', so assistive technology speaks the actual counts (for example, '2 cosigners') instead of a percentage. There is no security-relevant change.
No security action needed. Treat as a normal accessibility/usability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies AppController.java to call Platform.runLater(tabs::requestFocus) after selecting a newly added wallet tab, ensuring focus lands on the new tab rather than the status bar. In CosignersSlider.java, it changes the JavaFX AccessibleRole from SLIDER to SPINNER and replaces updateAccessibleValue() with a VALUE_STRING override so screen readers announce the numeric counts directly instead of deriving a percentage. The AccessibleAttribute notification changes from VALUE to VALUE_STRING. No cryptographic, storage, network, or permission logic is touched.
Changed components
src/main/java/com/sparrowwallet/sparrow/AppController.javasrc/main/java/com/sparrowwallet/sparrow/control/CosignersSlider.javaInspect captured patch +10 / −12
### src/main/java/com/sparrowwallet/sparrow/AppController.java
@@ -1799,6 +1799,8 @@ public void addWalletTab(Storage storage, Wallet wallet) {
tabs.getTabs().add(tab);
tabs.getSelectionModel().select(tab);
+ //Focus goes to the new tab rather than falling to the status bar from the view the wallet was opened from
+ Platform.runLater(tabs::requestFocus);
File oldWalletFile = renamedWallets.remove(storage.getWalletFile());
if(oldWalletFile != null) {
### src/main/java/com/sparrowwallet/sparrow/control/CosignersSlider.java
@@ -14,18 +14,20 @@
import org.controlsfx.control.RangeSlider;
/**
- * Range slider for the multisig threshold (low thumb) and number of cosigners (high thumb), exposed to screen readers as a slider
+ * Range slider for the multisig threshold (low thumb) and number of cosigners (high thumb), exposed to screen readers as a spinner
* for whichever thumb is selected. The thumbs are not controls, so without this the slider has no role, value or name.
*/
public class CosignersSlider extends RangeSlider {
- private final InvalidationListener accessibleValueListener = _ -> updateAccessibleValue();
+ private final InvalidationListener accessibleValueListener = _ -> notifyAccessibleAttributeChanged(AccessibleAttribute.VALUE_STRING);
private final EventHandler<KeyEvent> sceneKeyPressedFilter = event -> shiftTabPressed = event.getCode() == KeyCode.TAB && event.isShiftDown();
private final EventHandler<KeyEvent> sceneKeyReleasedFilter = _ -> shiftTabPressed = false;
private boolean shiftTabPressed;
private Node highThumb;
public CosignersSlider() {
- setAccessibleRole(AccessibleRole.SLIDER);
+ //A spinner rather than a slider: screen readers announce a slider's changing value as a percentage of its range, but a
+ //spinner's as its text, so the counts are spoken as they change
+ setAccessibleRole(AccessibleRole.SPINNER);
lowValueProperty().addListener(accessibleValueListener);
highValueProperty().addListener(accessibleValueListener);
skinProperty().addListener((_, _, _) -> {
@@ -73,24 +75,18 @@ public CosignersSlider() {
});
}
});
- updateAccessibleValue();
}
private boolean isHighThumbSelected() {
return highThumb != null && highThumb.isFocused();
}
- private void updateAccessibleValue() {
- //Screen readers announce a slider's value as a percentage of its range, so the counts are given in the name
- int required = (int)getLowValue();
- int cosigners = (int)getHighValue();
- setAccessibleText(isHighThumbSelected() ? cosigners + (cosigners == 1 ? " cosigner, " : " cosigners, ") + required + " required to sign" : required + " of " + cosigners + " required to sign");
- notifyAccessibleAttributeChanged(AccessibleAttribute.VALUE);
- }
-
@Override
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) {
return switch(attribute) {
+ //Only the value is spoken when it changes or the other thumb is selected, so it says which count it is
+ case VALUE_STRING -> isHighThumbSelected() ? (int)getHighValue() + ((int)getHighValue() == 1 ? " cosigner" : " cosigners")
+ : (int)getLowValue() + " of " + (int)getHighValue() + " signatures required";
case VALUE -> isHighThumbSelected() ? getHighValue() : getLowValue();
case MIN_VALUE -> getMin();
case MAX_VALUE -> getMax();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.