Skip to content

Windows 10/11 Calculator: "list index out of range" when entering expressions in portable NVDA with Calculator compact overlay on #14679

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

Closed
josephsl opened this issue Feb 27, 2023 · 0 comments · Fixed by #14745
Labels
app/windows-interface Interactions between NVDA and the default Windows GUI p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@josephsl
Copy link
Collaborator

Hi,

Discovered while testing parts of Windows App Essentials add-on in hopes of catching out of date documentation:

Steps to reproduce:

Prerequisites: a portable copy of NVDA with no add-ons, Windows 10/11 Calculator:

  1. Start Calculator.
  2. Press Alt+H, then select "standard calculator".
  3. Press Alt+Down arrow to make sure Calculator is displaying with all controls shown.
  4. Enter expressions, and NVDA will annonce expressions and results when Enter is pressed.
  5. Press Alt+Up arrow to switch to compact overlay.
  6. Enter calculations.

Actual behavior:

Calculations are announced in installed copy but does not on portable copy, resulting in the following traceback:

ERROR - eventHandler.executeEvent (08:53:02.104) - MainThread (22024):
error executing event: UIA_notification on <NVDAObjects.Dynamic_EditableTextWithAutoSelectDetectionUIA object at 0x0418D910> with extra args of {'notificationKind': 4, 'notificationProcessing': 1, 'displayString': 'Display is 15', 'activityId': 'DisplayUpdated'}
Traceback (most recent call last):
File "eventHandler.pyc", line 300, in executeEvent
File "eventHandler.pyc", line 101, in init
File "eventHandler.pyc", line 110, in next
File "appModules\calculator.pyc", line 94, in event_UIA_notification
IndexError: list index out of range

Expected behavior:

Both installed and portable copy announces calculations and results with compact overlay on or off.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

Installed and portable

NVDA version:

alpha-27763,d957a684

Windows version:

Windows 11 22H2 build 22621.1265

Name and version of other software in use when reproducing the issue:

Windows Calculator 11.2210.0.0

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Reproducible in 2022.4 and 2023.1 beta 2

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not applicable

Technical details:

UIA notification event handler inside Calculator app module performs object hierarchy traversal to locate results. While useful, object traversal has become an issue with changes to UIA tree in places such as Notepad and Calculator. The traceback is caused by the fact that, in Calculator compact overlay interface, NVDA cannot locate child elements of the foreground window properly. A solution exists in the form of using UIA's own find descendants method, the method employed in places such as File Explorer to locate elements such as status bar (see PR #14622). The solution also removes the need to check Calculator versions.

Thanks.

@seanbudd seanbudd added p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority app/windows-interface Interactions between NVDA and the default Windows GUI triaged Has been triaged, issue is waiting for implementation. labels Mar 7, 2023
josephsl added a commit to josephsl/nvda that referenced this issue Mar 25, 2023
josephsl added a commit to josephsl/nvda that referenced this issue Mar 25, 2023
…access#14679.

If a portable copy of NVDA is running and compact overlay mode is active from Calculator, NVDA will not announce results as users type expressions, caused by index error stemming from tree traversal failure. As an alternative, use UIA descendants to locate results element, allowing portable NVDA to announce results when Calculator is in compact overlay mde. The find descendants code ultimately comes from the one employed in File Explorer when fetching status bar items.
josephsl added a commit to josephsl/nvda that referenced this issue Mar 25, 2023
…fetching results element. Re nvaccess#14679.

NVDA had to descend one more level when fetching results in Windows 11 Calculator. Now that the moer modern Calculator is available on Windows 10 along with use of UIA descendants to fetch results element, there is no need to check app version.
seanbudd added a commit that referenced this issue Mar 28, 2023
…lts while handling UIA notification event (#14745)

Closes #14679

Summary of the issue:
Portable NVDA does not announce results when Windows 10/11 Calculator is in compact overlay mode.

Description of user facing changes
Portable copy of NVDA will announce calculator expressions and results when Windows Calculator is in compact overlay mode (Alt+up arrow from standard calculator mode).

Description of development approach
Instead of using tree traversal, use UIA find descendants approach (employed in File Explorer) to obtain results element when Calculator is in normal and compact overlay mode. This also removes the need to check Calculator version as Windows 11 Calculator has made its way to Windows 10.

Commits:

* appModules/calculator: update copyright year. Re #14679

* Calculator/UIA notification: fetch results via UIA descendants. Re #14679.

If a portable copy of NVDA is running and compact overlay mode is active from Calculator, NVDA will not announce results as users type expressions, caused by index error stemming from tree traversal failure. As an alternative, use UIA descendants to locate results element, allowing portable NVDA to announce results when Calculator is in compact overlay mde. The find descendants code ultimately comes from the one employed in File Explorer when fetching status bar items.

* Calculator: remove app version variable as it is no longer used when fetching results element. Re #14679.

NVDA had to descend one more level when fetching results in Windows 11 Calculator. Now that the moer modern Calculator is available on Windows 10 along with use of UIA descendants to fetch results element, there is no need to check app version.

* update changes

---------

Co-authored-by: Sean Budd <sean@nvaccess.org>
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app/windows-interface Interactions between NVDA and the default Windows GUI p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
3 participants