Skip to content

Add "Only in edit controls" mode for typing echo#17505

Merged
SaschaCowley merged 44 commits into
nvaccess:masterfrom
cary-rowen:TypedWords
Jan 22, 2025
Merged

Add "Only in edit controls" mode for typing echo#17505
SaschaCowley merged 44 commits into
nvaccess:masterfrom
cary-rowen:TypedWords

Conversation

@cary-rowen

@cary-rowen cary-rowen commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #16848, related #10331, #3027

Summary of the issue:

Currently NVDA can only toggle typing echo (characters and words) on or off globally. Users want more granular control to only have typing feedback in edit controls, while keeping it off in other contexts like listss or non-edit areas.

Description of user facing changes

  • Added a new option "Only in edit controls" for both "Speak typed characters" and "Speak typed words" settings in Keyboard Settings
  • Instead of checkboxes, these are now combo boxes with three options:
    • Off: No typing echo
    • Only in edit controls: Only echo text typed in edit fields
    • Always: Echo all typed text
  • By default, "Speak typed characters" is now set to "Only in edit controls".
  • Updated relevant documentation in the user guide

Description of development approach

The implementation:

  1. Added a TypingEcho enum in configFlags.py with values:
    • OFF (0)
    • EDIT_CONTROLS (1)
    • ALWAYS (2)
  2. Changed keyboard typing echo configuration from boolean to integer values
  3. Updated speech.py, behaviors.py and inputComposition.py to use the new enum
  4. Modified settings dialog to use combo box instead of checkbox
  5. Updated documentation

Testing strategy:

Tested the following scenarios:

  1. Basic functionality:
  • Open Notepad (edit control)
    • Set to "Only in edit controls"
    • Type text - should be announced
    • Verify both character and word echo settings
  • Explorer file lists(non-edit control)
    • Type text - should not be announced
  • Test all three modes (Off, On, Only in edit controls)
  1. Different contexts:
  • Web browser input fields
  • Rich text editors
  • Read-only text areas
  • Terminal windows

Known issues with pull request:

None identified.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@cary-rowen cary-rowen marked this pull request as draft December 11, 2024 23:28
@Adriani90

Copy link
Copy Markdown
Collaborator

Great work on this, thank you.

@Adriani90

Copy link
Copy Markdown
Collaborator

I think this needs a changelog entry as well.

@AppVeyorBot

Copy link
Copy Markdown
  • PASS: Translation comments check.
  • PASS: License check.
  • PASS: Unit tests.
  • FAIL: Lint check. See test results and lint artifacts for more information.
  • PASS: System tests (tags: installer NVDA).
  • Build (for testing PR): https://ci.appveyor.com/api/buildjobs/2b1503020gqhri7g/artifacts/output/l10nUtil.exe nvda_snapshot_pr17505-34744,8a5bed98.exe
  • CI timing (mins):
    INIT 0.0,
    INSTALL_START 1.2,
    INSTALL_END 0.9,
    BUILD_START 0.0,
    BUILD_END 25.6,
    TESTSETUP_START 0.0,
    TESTSETUP_END 0.3,
    TEST_START 0.0,
    TEST_END 18.7,
    FINISH_END 0.1

See test results for failed build of commit 8a5bed9868

@cary-rowen cary-rowen marked this pull request as ready for review December 12, 2024 03:33
@AppVeyorBot

Copy link
Copy Markdown
  • PASS: Translation comments check.
  • PASS: License check.
  • PASS: Unit tests.
  • FAIL: Lint check. See test results and lint artifacts for more information.
  • PASS: System tests (tags: installer NVDA).
  • Build (for testing PR): https://ci.appveyor.com/api/buildjobs/8dcauldlcfjvaodn/artifacts/output/l10nUtil.exe nvda_snapshot_pr17505-34752,259e6d54.exe
  • CI timing (mins):
    INIT 0.0,
    INSTALL_START 1.2,
    INSTALL_END 0.9,
    BUILD_START 0.0,
    BUILD_END 24.6,
    TESTSETUP_START 0.0,
    TESTSETUP_END 0.3,
    TEST_START 0.0,
    TEST_END 18.6,
    FINISH_END 0.2

See test results for failed build of commit 259e6d5452

@CyrilleB79

Copy link
Copy Markdown
Contributor

Very nice addition @cary-rowen! Thanks.

I have some questions:

  1. Shouldn't there be a config upgrade? I.e. a value in the old config should remain in the new one.
  2. I think that "Only in edit controls" should become the default behaviour; I guess that most people would be happy and moreover, it's a security fix as described in NVDA reading out words it shouldn't if 'speak typed words' is on #10331.
  3. If NV Access reviewers (@SaschaCowley or @seanbudd) do not accept the new behaviour to be the default for now, should we use a feature flag to be able to change the default in the future?
  4. With the new option, can typing be heard when typing in an edit field but when text is not actually written, e.g.:
    • In cmd, when initiating an ssh connection, typing the password outputs no visible character
    • In a read-only edit field, e.g. the synth field of NVDA speech settings panel.

@nvdaes nvdaes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cary-rowen , thanks for this.
I think that you may add a helper function in globalCommands, similar to the toggleBooleanValue function, for config flags, and use it for toggling typed characters and words.
For reference, see toggleBooleanValue in globalCommands.py, introduced in PR #16994

@cary-rowen

Copy link
Copy Markdown
Contributor Author

Hi @CyrilleB79
Thank you for your review! I'd like to clarify your last point about special input scenarios. Are you asking whether the new "Only in edit controls" option works as expected in these cases:

  1. When typing passwords in cmd during SSH connection:
  • Should typed characters be announced in this case?
  1. In read-only edit fields (like the synthesizer field in NVDA speech settings):
  • Though it looks like an edit field, it's read-only
  • I've tested that typed characters are not announced here with the new option, as no text can be entered
  • Is this the expected behavior?

Could you please confirm if these behaviors are what you're asking about, and what the expected behavior should be in these cases?

Many thanks

@cary-rowen

Copy link
Copy Markdown
Contributor Author

Regarding default settings, I'd also love to hear suggestions from NV Access, I'd personally like to see new options provided as defaults for the same reasons as @CyrilleB79.

@nvdaes
Thanks for your suggestion, I will implement a helper method to simplify the code.

@CyrilleB79

Copy link
Copy Markdown
Contributor

@cary-rowen IMO, the expected behaviour with the new option in ssh password case and in read-only edit fields such as synthesizer is that NVDA should not speak anything since nothing is actually visible on the screen.

@amirmahdifard

Copy link
Copy Markdown

thaaaaanks! should I really beleave that from now on we can get rid of the t. This pc 10 of 18, or space. playback stopped, and space. Playback resumed, with out needing to install the best ever addon made by @cary-rowen that addon was the best, because I alwayes liked and needed to keep typed characters and words, but I hated how they are announced everywhere, I was thinking, how stupid, the option it self is called speeck ('"typed"') characters and words, but why whe were hearing it everywhere? whe are not typing anything! whe are using our keyboard to use and explor our computer! but from now on, at least we don't have to use an addon to solv this really annoying this. And, really thank you @cary-rowen for resolving such problem for us until now. befor your addon releace on the stor, I was using an old and less buggy vertion of an unknown addon called typing settings to solv this for my self. greate feature!

@Adriani90

Copy link
Copy Markdown
Collaborator

@cary-rowen speaking typed characters outside of edit fields does not make sense anyway, because they are not typed, but only pressed. For that we have the input help feature already if people need to learn the keyboard layout outside of edit fields.
So unless there is a valid use case for having characters being spoken outside of edit fields,
Why don't you just change the current setting when enabled to be valid only for edit fields?
In this case we could let it be a checkbox and don't need three options.

@amirmahdifard

Copy link
Copy Markdown

@Adriani90 hi. No, I also don't agree for removal of that in my opinion because, input help is a thing, but this is stil needed for some people where they need to press some keys and need to be announced for them what they've preased and what came up, or what happened as a result, while some newbie people need to turn on input help, press a fue keys that they need, and turn of input help, and make sure they've pressed or pressing the correct key. Also, for a groupe of users with old habit, better to not remove it but rename it instead for example, from on, to everywhere. so the options are as folows. off, in edit boxes only, everywhare.

@SaschaCowley SaschaCowley added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Dec 17, 2024
@cary-rowen

Copy link
Copy Markdown
Contributor Author

@CyrilleB79
wrote:

the expected behaviour with the new option in ssh password case and in read-only edit fields such as synthesizer is that NVDA should not speak anything since nothing is actually visible on the screen.

I agree that there shouldn't be any feedback in the read-only edit box after enabling the new options introduced by this PR. This is currently as expected.
However, I would like to have feedback when typing the password in ssh, unlike other password fields, in the normal password field NVDA will report 'star' when typing the password.
In the SSH password field, the characters are actually entered, they are just not displayed, unlike read-only fields (which do not produce any input)

cc @seanbudd

@cary-rowen

Copy link
Copy Markdown
Contributor Author

I agree with @amirmahdifard I am totally not in favor of removing the original mode.

@nvdaes nvdaes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cary-rowen I've reviewed changes in globalCommands.py.
Looks good to me, except for minor inconsistencies in comments for translators.

Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cary-rowen , looks good!

@cary-rowen

Copy link
Copy Markdown
Contributor Author

I've updated the original description with the latest changes. If there is anything else I need to do before merging please let me know.
cc @SaschaCowley @seanbudd

@SaschaCowley

Copy link
Copy Markdown
Member

Thanks @cary-rowen, we're just waiting on @Qchristensen to look over the documentation changes.

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@SaschaCowley

Copy link
Copy Markdown
Member

@cary-rowen please resolve merge conflicts

@SaschaCowley SaschaCowley merged commit 605db3e into nvaccess:master Jan 22, 2025
@github-actions github-actions Bot added this to the 2025.1 milestone Jan 22, 2025
SaschaCowley added a commit that referenced this pull request Jan 24, 2025
Fixes #17637
Follow-up to #17505

Summary of the issue:
The config upgrade steps for moving from version 14 to 15 of the config schema may leave the user's config in an invalid state if either of `["keyboard"]["speakTypedCharacters"]` or `["keyboard"]["speakTypedWords"]` is not a boolean.
This is because the upgrade steps, as implemented, take no action if those values are not bools.
For most upgrade steps, this approach is perfectly valid.
However, version 15 of the schema expects these values to be integers, so validation of the upgraded config will fail.

Description of user facing changes
The configuration upgrade should not corrupt the user's config.

Description of development approach
Instead of just `return`ing when we get a `ValueError` in `upgradeConfigFrom_14_to_15`, delete the offending config entry.


Testing strategy:
Tested by creating valid and invalid config strings, instantiating `ConfigObj`s with them, and feeding those to `upgradeConfigFrom_14_to_15`.

Known issues with pull request:
A user may lose their setting for "Speak typed characters" or "Speak typed words", if configobj doesn't recognise it as a boolean.
Theoretically this shouldn't be possible, as the config wouldn't have validated under any of the prior schema versions.
Nevertheless this seems to have happened, and it is better to lose (at most) 2 settings than all settings.
LeonarddeR pushed a commit to LeonarddeR/nvda that referenced this pull request Feb 4, 2025
)

Fixes nvaccess#17637
Follow-up to nvaccess#17505

Summary of the issue:
The config upgrade steps for moving from version 14 to 15 of the config schema may leave the user's config in an invalid state if either of `["keyboard"]["speakTypedCharacters"]` or `["keyboard"]["speakTypedWords"]` is not a boolean.
This is because the upgrade steps, as implemented, take no action if those values are not bools.
For most upgrade steps, this approach is perfectly valid.
However, version 15 of the schema expects these values to be integers, so validation of the upgraded config will fail.

Description of user facing changes
The configuration upgrade should not corrupt the user's config.

Description of development approach
Instead of just `return`ing when we get a `ValueError` in `upgradeConfigFrom_14_to_15`, delete the offending config entry.


Testing strategy:
Tested by creating valid and invalid config strings, instantiating `ConfigObj`s with them, and feeding those to `upgradeConfigFrom_14_to_15`.

Known issues with pull request:
A user may lose their setting for "Speak typed characters" or "Speak typed words", if configobj doesn't recognise it as a boolean.
Theoretically this shouldn't be possible, as the config wouldn't have validated under any of the prior schema versions.
Nevertheless this seems to have happened, and it is better to lose (at most) 2 settings than all settings.
seanbudd pushed a commit that referenced this pull request Apr 7, 2025
…controls'. (#17905)

Fixes #17670

Summary of the issue:
#17505 introduced the functionality where typed characters are only spoken when typing within editable controls. However, the input area in the modern Windows Calculator is not a standard editable control. Furthermore, it appears that almost any focused element within the Calculator can capture user input as part of the mathematical expression.

Description of user facing changes
Users will now hear typed characters in the Calculator even when the "Speak typed characters" option is set to 'Only in edit controls'.

Description of development approach
I handled the event_typedCharacter event within the "calculator" app module by temporarily switching the speakTypedCharacters mode to ALWAYS when the original setting is EDIT_CONTROLS, thereby ensuring NVDA reports the typed character.

As noted above, since it seems almost any focused element in the Calculator accepts user input for the expression, I did not restrict this handling to specific objects within the Calculator.

While this successfully restores the previous behavior, I have some reservations about this approach:

Within the Calculator, the 'Only in edit controls' setting now behaves identically to 'Always'. If a user prefers not to hear typed characters in the Calculator specifically, they would have to turn the global setting off entirely.
In the Calculator's "Converter" modes (e.g., Currency Converter, Temperature Converter), NVDA already announces the updated result with each keypress. With this change, NVDA will announce the typed character and the result, leading to the character being effectively spoken twice in quick succession, which might be slightly verbose or annoying.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-breaking-change conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speak typed characters and words applied to edit fields only.