-
Notifications
You must be signed in to change notification settings - Fork 6
Speech.js
This file contains everything necessary to read things with the screen reader. One of the most important features of this file is the Say('string to be read') function that will read out the given string immediately to the user. This function is primarily used for alerting and updating the user when needed.
The majority of block reading is handled in speech.js. Default strings for each block are stored in the method blockToString. Each string denotes potential inner blocks with ( ) and fields with ' '. Regex is used to replace these symbols with the appropriate content as the workspace changes.
type - The type of block selected.
disabled - Used during the process to connect blocks, it is a boolean representing if the block is disabled in the menu. If it is disabled the block reads "connection doesn't match" followed by the default block string.
Returns default string of the block
Creates the string to be read by the screenreader using the xml of blocks in the workspace.
block - The xml of the currently selected block
xmlDoc - The xml of all of the blocks on the workspace
Variables
strArr - Stores the default str of every block.
blockArr - Stores every block to be read.
fieldBlcArr - Stores the tags of the blocks in blockArr.
fieldValArr - Stores the values of all fields in blockArr.
How it works
- strArr is populated with default strings.
- fieldValArr is populated with all field values.
- Replace instances of ' ' in the strings with the field values.
- Combine each element of strArr into strArr[0] by replacing ( ) with the next string in the array.
Returns newStr (strArr[0] with updated values).
Changes the letter representations of field values into words. (example: EQ = equals)
defaultName - Usually denoted as 2 - 4 capital letters in a field tag.
blockType - The type of block being updated. This is currently only used for the text_charAt block so that it can be worded logically. This parameter most likely be replaced with a better solution.
Returns the word equivalent of the default name in lowercase due to screenreaders sometimes reading capital letters individually. ##}