Skip to content

Speak typed characters in Calculator when echo mode is 'Only in edit controls'.#17905

Merged
seanbudd merged 3 commits into
nvaccess:betafrom
cary-rowen:fixCalc
Apr 7, 2025
Merged

Speak typed characters in Calculator when echo mode is 'Only in edit controls'.#17905
seanbudd merged 3 commits into
nvaccess:betafrom
cary-rowen:fixCalc

Conversation

@cary-rowen

Copy link
Copy Markdown
Contributor

Link to issue number:

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:

  1. 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.
  2. 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.

Testing strategy:

Manual testing.

Known issues with pull request:

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 requested a review from a team as a code owner April 6, 2025 03:38
@cary-rowen cary-rowen requested a review from seanbudd April 6, 2025 03:38
@cary-rowen

Copy link
Copy Markdown
Contributor Author

cc @josephsl
Your feedback on this implementation would be appreciated.

@josephsl

josephsl commented Apr 6, 2025

Copy link
Copy Markdown
Contributor

Hi,

I think the code works, although it would be best to let others test and offer comments.

Thanks.

@cary-rowen cary-rowen changed the base branch from master to beta April 6, 2025 15:27
Comment thread source/appModules/calculator.py Outdated
@seanbudd seanbudd merged commit efe1a18 into nvaccess:beta Apr 7, 2025
@github-actions github-actions Bot added this to the 2025.2 milestone Apr 7, 2025
seanbudd pushed a commit that referenced this pull request Apr 8, 2025
…cho mode is 'Only in edit controls'. (#17913)

Addresses #17670 for the classic Windows Calculator. Follow-up to PR #17905.

Summary of the issue:

Similar to the issue observed in the modern Windows Calculator, the classic Windows Calculator's display area does not consistently trigger character echo when NVDA's "Speak typed characters" setting is configured to 'Only in edit controls'.

Description of user facing changes

Users will now hear typed characters echoed when typing into the display field of the classic Windows Calculator, even when the "Speak typed characters" option is set to 'Only in edit controls'.

Description of development approach

This change mirrors the approach taken for the modern Calculator in PR #17905.
The event_typedCharacter method within the Display overlay class (which specifically targets the display controls of the classic Calculator in calc.py) is modified. When this event occurs and the original speakTypedCharacters mode is EDIT_CONTROLS, the mode is temporarily switched to ALWAYS before calling the parent class's event handler. The original mode is then restored in a finally block.
@seanbudd seanbudd modified the milestones: 2025.2, 2025.1 Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The entering of digits in the Windows Calculator is not announced by NVDA if "Speak typed characters" is set to "Only in edit controls"

3 participants