-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 10/11 Calculator: allow NVDA to announce more operations by suppressing only a limited number of keyboard commands #13383
Comments
Thank you @josephsl for all these details. Could the technical, development and implementation details be moved to an empty (zero-diff) PR, i.e a new branch off of master? |
Hi, that’s the plan once I get around to doing this work, perhaps as early as late northern spring (May) as with all of my other past PR’s. Thanks.
|
Hi, March 2022 update: as noted in the additional context section, 1709 will not make the cut - the latest Calculator release for Windows 10 Fall Creators Update (unsupported) is 10.1804 which apparently does not use UIA notification event. While it would be better to check Calculator version (10.1908 or later), for simplicity, Windows 10 April 2018 Update (1803) will be checked unless product version check would be better (I think I might as well use product version route). Thanks. |
In recent Calculator releases (prominently from 10.1908 but exact version unknown), UIA notification event is used to anounce results. Back when Calculator used name change and live region events, it was necessary to define result announcement keys such as Enter key that will cause NVDA to announce results. With the introduction of UIA notification event, the new event is used to announce results. This resulted in NVDA announcing repeats when numbers were entered, more so if speak typed characters is on. In the initial version of Windows 10 Calculator app module (2020) and subsequently amended in 2021, only a select number of keyboard commands (gestures) were defined to announce results. This however led to NVDA not announcing Calculator display when additional result keys such as equals (=) and scientific calculator commands such as S for sine were pressed, requiring users to perform read current line/focused object to obtain results. To resolve this and to respond to UIA notification events properly while keeping the number entry bug fix intact, a new flag is used to preventNVDA from handling notification event if number row and/or numpad keys with num lock on are pressed. This flag is set if number keys are indeed entered and cleared from notification event (next set of commits). In addition, existing result announcement commands wil be tweaked to do nothing if using later Calculator releases since notification event is used to announce resuts anyway (this means verbosity changes such as NVDA not announcing display content if Escape key is pressed multiple times, for example). Note that the new flag (no result gestures) should not be confused with existing 'should announce results' flag as the existing flag is used to handle old Calculator releases with no support for notification event.
…estures are pressed. Re nvaccess#13383. Do not handle UIA notification event if no result gestures flag is set in order to avoid repetitions. As the flag is set from a script (see next commit), have a copy of this flag before clearing the flag from notification event. The event handler copy of the no results flag will be used later when handling 'DisplayUpdated' activity Id (results display), and if set, return from the event handler.
… Re nvaccess#13383. In addition to notification event handler tweak, add a script that defines gestures for which NVDA should not announce Calculator results. For now number row and numpad keys with num lock turned on are defined specifically to keep no repetition announcement bug fix intact (where NVDA will repeat things if speak typed characters is on).
…ion 10.1908 and later. Re nvaccess#13383. Bonus: becasue UIA notification event is used to announce results, there is no need for NVDA to check focus in app version 10.1908 and later. Therefore return early from existing results announcement script if running on later Calculator releases (version string comparison will work).
Comment from Sean Budd (NV Access): better not to use string comparisons (what if comparisons fail for odd Calculator version strings that does not necessarily fit what humans think of newer releases versus what Python gives). Therefore obtain integers for major and minor Calculator releases and compare versions accordingly (integer list comparison).
…fication event (#13625) Link to issue number: Fixes #13383 Summary of the issue: With the initial version of Windows 10/11 Calculator app module, only a select number of keys were defined to announce results. However it turns out there are commands that should be announced such as equals (=) and scientific calculator commands such as s (sign). Description of how this pull request fixes the issue: Refactor UIA notification event handler with use of a new flag specifying gestures that should not announce results. If this flag is on (for now when number keys are pressed), NVDA will not announce results. Also, existing result announcement commands will not announce results in Calculator version 10.1908 as notification event will announce result. * appModules/calculator: explain the fact that Windows 10 Calculator is the base app module for Windows 11 Calculator (calculatorapp) as well. * Calculator: introduce a 'no result gestures' flag. Re #13383. In recent Calculator releases (prominently from 10.1908 but exact version unknown), UIA notification event is used to anounce results. Back when Calculator used name change and live region events, it was necessary to define result announcement keys such as Enter key that will cause NVDA to announce results. With the introduction of UIA notification event, the new event is used to announce results. This resulted in NVDA announcing repeats when numbers were entered, more so if speak typed characters is on. In the initial version of Windows 10 Calculator app module (2020) and subsequently amended in 2021, only a select number of keyboard commands (gestures) were defined to announce results. This however led to NVDA not announcing Calculator display when additional result keys such as equals (=) and scientific calculator commands such as S for sine were pressed, requiring users to perform read current line/focused object to obtain results. To resolve this and to respond to UIA notification events properly while keeping the number entry bug fix intact, a new flag is used to preventNVDA from handling notification event if number row and/or numpad keys with num lock on are pressed. This flag is set if number keys are indeed entered and cleared from notification event (next set of commits). In addition, existing result announcement commands wil be tweaked to do nothing if using later Calculator releases since notification event is used to announce resuts anyway (this means verbosity changes such as NVDA not announcing display content if Escape key is pressed multiple times, for example). Note that the new flag (no result gestures) should not be confused with existing 'should announce results' flag as the existing flag is used to handle old Calculator releases with no support for notification event. * Calculator: do not announce Calculator display content if no result gestures are pressed. Re #13383. Do not handle UIA notification event if no result gestures flag is set in order to avoid repetitions. As the flag is set from a script (see next commit), have a copy of this flag before clearing the flag from notification event. The event handler copy of the no results flag will be used later when handling 'DisplayUpdated' activity Id (results display), and if set, return from the event handler. * Calculator: add a script identifying no result announcement gestures. Re #13383. In addition to notification event handler tweak, add a script that defines gestures for which NVDA should not announce Calculator results. For now number row and numpad keys with num lock turned on are defined specifically to keep no repetition announcement bug fix intact (where NVDA will repeat things if speak typed characters is on). * Calculator: return from announcing results if this is Calculator version 10.1908 and later. Re #13383. Bonus: becasue UIA notification event is used to announce results, there is no need for NVDA to check focus in app version 10.1908 and later. Therefore return early from existing results announcement script if running on later Calculator releases (version string comparison will work). * Calculator: use integer comparisons for versions. Re #13383. Comment from Sean Budd (NV Access): better not to use string comparisons (what if comparisons fail for odd Calculator version strings that does not necessarily fit what humans think of newer releases versus what Python gives). Therefore obtain integers for major and minor Calculator releases and compare versions accordingly (integer list comparison). * update changes Co-authored-by: Sean Budd <sean@nvaccess.org>
…Version for consistency. (#13696) Follow-up to #13383 Summary of the issue: Cosmetics: focus.appModule.productVersion -> self.productVersion for consistency. Description of how this pull request fixes the issue: Changes focus.appModule.productVersion to self.productVersion in Calculator results script. No changes to functionality whatsoever.
When checking the change log translation, I have found a wrong reference in an item of the change log. I have thus checked all the refs for 2022.2. Link to issue number: None Follow-up of various issues. Summary of the issue: Some of the GitHub references in the change log were targetting wrong issue or PR. Description of user facing changes The references have been fixed in the change log document. Description of development approach Fixed the following references: Fixup of PR 13082: fix a misspell in DefaultAppArgs and no longer use globalVars.appArgs in a boolean context (#13386) #13386 replaced by Windows 10/11 Calculator: allow NVDA to announce more operations by suppressing only a limited number of keyboard commands #13383 Revert "Update to py2exe 0.11.0.1 (#13066)" #13508 replaced by Windows 11 Design Elements Are Not Reported by NVDA When Mouse Tracking Is On #13506 Fixup of PR 13082: fix a misspell in DefaultAppArgs and no longer use globalVars.appArgs in a boolean context (#13386) #13386 (bis) replaced by Windows 11 Notepad: status bar is not announced #13688 Also, I have replaced #13276 (Libre Office issue) by #13277 (associated PR) since the issue description is not related at all with the change for developers.
Hi,
This amounts to a substantial redesign of Windows 10/11 Calculator app module, therefore I think it would be best to queue this for 2022.2 or later:
Background:
A consequence of Windows as a Service (WaaS) introduced with Windows 10 (2015) is continuous ap updates, specifically apps preinstalled on PC's. One of these is Calculator (calculator.exe), which went through different user interface designs and added features over the years.
One of the biggest changes in Calculator came in 2018. With Windows 10 Version 1709 (Fal Creators Update) adding UIA notification event (part of IUIAutomation5 interface), Calculator app uses notification event to announce calculator display content changes. Prior to this, a combination of name change and live region was used to announce display content. With NVDA taking advantage of UIA notification event in 2018, it became possible for the screen reader to announce display content on supported Calculator app releases.
Then in 2020, NVDA added support for Windows 10 Calculator, which originated from Windows App Essentials add-on. In its early days, the NVDA Core version of Calculator app allowed NVDA to announce display content when a limited number of keyboard keys are pressed such as Escape, Enter, and Delete. Refinements followed such as announcing display content on braille displays, and with 2022.1, Windows 11 Calculator support.
In its original design, Calculator app module does not announce display content when number row keys are pressed. In fact, there are keyboard shortcuts in scientific mode such as "S" for sine that are not announced by NVDA. This stems from the fact that NVDA ignores DisplayUpdated activity Id altogether in order to solve double announcement problem where" speak typed characters" enabled causes NVDA to announce both the entered number and display content (for example, typing "2" results in NVDA saying "2, display is 2"). This design led to a discussion on NVDA Users list (see the reference in the end) where a user brought up the following suggestion.
Is your feature request related to a problem? Please describe.
When a calculator command such as + (plus) or = (equals) is pressed, NVDA does not announce results (specifically, calculator display content). Further, scientific mode results are not announced when operations such as trigonometric, logarithmic, factorial and other functions are performed. The issue was traced to the original design of Calculator app module (see above).
Describe the solution you'd like
Redesign the UIA notification event handler so it can ignore commands that should not result in NVDA announcing display content. For now number row keys will be marked as "no calculator results" list. Also, change calculator results script so it can just send gestures when using Windows 10 Version 1709 or later as this script was really optimized for an era without UIA notification event (virtually prior to 2018). See the "additional context" section on justifications.
Specifically:
Describe alternatives you've considered
Define a list of keyboard shortcuts for Calculator that NVDA should announce. Note that this approach is not really future-proof because Microsoft can add or change commands in the future, made a bit easier to predict since Calculator is open-source (hosted on GitHub). Another option is keep Calculator app module in Core as is and let add-ons change the behavior, but that is not ideal for folks who may not elect to use add-ons for any reason (and in case NVDA is downloaded from Microsoft Store on educational devices running Windows 10 in S mode or Windows 11 SE).
Additional context
Below highlights possible questions and justifications for the proposed solution.
Why UIA notification event?
Increasingly, as discussed in a recent Windows Terminal issue that @codeofdusk commented, Microsoft is electing to use UIA notification event (prototype in Terminal) to notify assistive technologies about screen content changes. The best example, although not working properly for now, is Voice Access in Windows 11 Insider Preview where UIA notification event is used to communicate microphone status; a working example is page load status in Microsoft Edge.
Calculator is no exception, more so since 2018. Calculator does use UIA notification event to communicate screen content changes. Since the issue at hand is NVDA's UIA notification event handler (from client side), it makes sense to refine Calculator's own notification event handler method.
You mention Windows 10 Version 1709 a lot. Why?
This is the feature update that introduced UIA notification event, and from practical point of view, it is the earliest Windows 10 release that the proposed solution is applicable to. However, as explained in the next justification, 1709 will not make the cut.
How about older Windows 10 releases?
Older Windows 10 releases are not supported by Microsoft except for mission-critical devices. Since these devices are really meant for specialized uses, a version of Windows 10 Enterprise, aprtly named "Windows 10 Enterprise Long-Term Servicing Branch/Channel" is available. Windows 10 Enterprise LTSB/LTSC does not include modern apps such as Calculator, making the proposed solution not applicable.
But wait, you said Version 1709 did not make the cut. Why?
As of time of this issue submission, the oldest supported Windows 10 release (apart from LTSB/LTSC releases) is Version 1909 (November 2019 Update) which is going out of support in May 2022. Therefore, from practical point of view, the earliest version that the proposed solution is applicable is Version 20H2 (October 2020 Update). The latest version of Calculator for Windows 10 is 10.2103.8.0, which supports Version 1803 (April 2018 Update) or later.
Will the proposed solution work on Windows 11?
Yes, as Windows 10 and 11 Calculator support comes from the base Calculator app module.
Is there a prototype?
Yes - Windows App Essentials February 23rd development snapshot or later includes a prototype of the proposed solution.
Why delay the implementation to 2022.2 or later?
NVDA 2022.1 beta is very close at hand - master to beta and beta to master data exchange took place a few days ago, which is a key sign that signifies the imminent release of a beta version for wider testing. Also, since 2022.1 is a compatibility breaking release, more effort should be spent on testing these changes. Also, the proposed solution is in is infancy (prototype just released), it will take weeks to gather additional data, which can then inform the accompanying pull request.
References:
Thanks.
The text was updated successfully, but these errors were encountered: