Fix: Correct screen reader announcement order for blocks#1678
Merged
PranavPurwar merged 1 commit intoSketchware-Pro:mainfrom Jun 18, 2025
makhlwf:fix/screen-reader-block-name
Merged
Fix: Correct screen reader announcement order for blocks#1678PranavPurwar merged 1 commit intoSketchware-Pro:mainfrom makhlwf:fix/screen-reader-block-name
PranavPurwar merged 1 commit intoSketchware-Pro:mainfrom
makhlwf:fix/screen-reader-block-name
Conversation
Previously, screen readers would announce block names (e.g., "SetActivityTitle") in a misparsed order (e.g., "Activity, title, set"). This was likely due to default accessibility behavior splitting the CamelCase name and reordering it. This commit addresses the issue by modifying `PaletteBlock.java`: 1. A helper function `generateContentDescription(String name)` was added to convert CamelCase/PascalCase names into a space-separated format (e.g., "SetActivityTitle" becomes "Set Activity Title"). 2. The methods responsible for creating block views (`Rs` instances) now use this helper function to generate a `contentDescription` from the block's opCode (which typically holds the CamelCase name). 3. This generated `contentDescription` is then explicitly set on the block view, ensuring screen readers announce the name in the correct, intended order. I recommend that you manually test with an accessibility inspector and a screen reader (like TalkBack) to confirm the fix across various block types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, screen readers would announce block names (e.g., "SetActivityTitle") in a misparsed order (e.g., "Activity, title, set"). This was likely due to default accessibility behavior splitting the CamelCase name and reordering it.
This commit addresses the issue by modifying
PaletteBlock.java:generateContentDescription(String name)was added to convert CamelCase/PascalCase names into a space-separated format (e.g., "SetActivityTitle" becomes "Set Activity Title").Rsinstances) now use this helper function to generate acontentDescriptionfrom the block's opCode (which typically holds the CamelCase name).contentDescriptionis then explicitly set on the block view, ensuring screen readers announce the name in the correct, intended order.Warning, the changes are made with AI. I have tested the fix by building the project and everything seems to work correctly. But if you want to merge this, please review it carefully. To see if it edited any existing functionality or if it broke it, because I'm not a Java developer.
thanks