keep the recent blocks summary current for screen readers
What changed, and why it matters
This commit fixes a user-interface accessibility bug. It makes a screen-reader summary of recent Bitcoin blocks update correctly when the underlying data changes, by switching the UI control's accessibility role and notifying assistive technology of text changes. There is no security relevance in the diff.
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 change is confined to RecentBlocksView.java. It adds an accessibleSummary field, introduces updateAccessibleSummary() to emit notifyAccessibleAttributeChanged(AccessibleAttribute.TEXT) only when the summary string changes, changes the AccessibleRole from TEXT to TEXT_FIELD (with EDITABLE=false), and calls updateAccessibleSummary() after block/fee-rate updates. This is purely an a11y improvement for assistive technologies such as VoiceOver.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/RecentBlocksView.javaInspect captured patch +16 / −1
### src/main/java/com/sparrowwallet/sparrow/control/RecentBlocksView.java
@@ -38,6 +38,7 @@ public class RecentBlocksView extends Pane {
private final ObjectProperty<List<BlockCube>> cubesProperty = new SimpleObjectProperty<>(new ArrayList<>());
private final Tooltip tooltip = new Tooltip();
+ private String accessibleSummary;
public RecentBlocksView() {
cubesProperty.addListener((_, _, newValue) -> {
@@ -54,25 +55,36 @@ public RecentBlocksView() {
for(BlockCube cube : getCubes()) {
cube.setElapsed(BlockCube.getElapsed(cube.getTimestamp()));
}
+ updateAccessibleSummary();
}));
FeeRatesSource feeRatesSource = Config.get().getFeeRatesSource();
feeRatesSource = (feeRatesSource == null ? FeeRatesSource.MEMPOOL_SPACE : feeRatesSource);
updateFeeRatesSource(feeRatesSource);
Tooltip.install(this, tooltip);
- setAccessibleRole(AccessibleRole.TEXT);
+ //A read-only text field rather than text, as VoiceOver keeps reading the first value it saw of text that later changes
+ setAccessibleRole(AccessibleRole.TEXT_FIELD);
}
@Override
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) {
//Read as one summary rather than the individual heights, fee rates and times on the cubes
return switch(attribute) {
case TEXT -> getSummary();
+ case EDITABLE -> false;
case CHILDREN -> FXCollections.emptyObservableList();
default -> super.queryAccessibleAttribute(attribute, parameters);
};
}
+ private void updateAccessibleSummary() {
+ String summary = getSummary();
+ if(!summary.equals(accessibleSummary)) {
+ accessibleSummary = summary;
+ notifyAccessibleAttributeChanged(AccessibleAttribute.TEXT);
+ }
+ }
+
private String getSummary() {
List<BlockCube> cubes = getCubes();
if(cubes.isEmpty()) {
@@ -159,6 +171,8 @@ public void update(List<BlockSummary> latestBlocks, Double currentFeeRate) {
updateFeeRate(currentFeeRate);
}
}
+
+ updateAccessibleSummary();
}
private void addNewBlock(List<BlockSummary> latestBlocks, Double currentFeeRate) {
@@ -205,6 +219,7 @@ public void updateFeeRate(Double currentFeeRate) {
if(!getCubes().isEmpty()) {
BlockCube firstCube = getCubes().getFirst();
firstCube.setMedianFee(currentFeeRate);
+ updateAccessibleSummary();
}
}
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.