Repository: nvaccess/nvda

Issue:
No braille feedback in Windows Calculator
### Steps to reproduce:
1. Open Windows Calculator.
2. Type 2
3. Type +
4. Type 3
5. Type = (or Enter)

Note that the new appmodule listens for the Enter key, but not the equals (=) key. However, both work to display the result. Speech reports the result when you press Enter, but braille provides no feedback regardless of what key you press.

### Actual behavior:
The braille display continues to show "Display is 0".
There are two problems with this:
1. As you type (without using speech) you cannot verify what you just entered.
2. Once the result appears, you cannot read it unless you temporarily move the focus away from the display and back again.

### Expected behavior:
The braille display shows each number, operator and result as you type.

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
2020.4

#### Windows version:
Version	10.0.19042 Build 19042

#### Name and version of other software in use when reproducing the issue:

#### 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.
Yes, it worked in NVDA 2019.3.

#### If add-ons are disabled, is your problem still occurring?
Yes

#### Did you try to run the COM registry fixing tool in NVDA menu / tools?
Yes


Discussion:
Hi, resolved in Windows 10 App Essentials 21.04 – at least braille will announce results. Letting braille announce expressions as you type will require some time to tweak UIA notification event. I’ll submit a pull request that will resolve results announcement and add Delete to Calculator commands within the next 24 hours. Thanks for reminding me about this.

 

From: Davy Kager ***@***.***> 
Sent: Sunday, April 4, 2021 9:09 AM
To: nvaccess/nvda ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [nvaccess/nvda] No braille feedback in Windows Calculator (#12268)

 


Steps to reproduce:


1.	Open Windows Calculator.
2.	Type 2
3.	Type +
4.	Type 3
5.	Type = (or Enter)

Note that the new appmodule listens for the Enter key, but not the equals (=) key. However, both work to display the result. Speech reports the result when you press Enter, but braille provides no feedback regardless of what key you press.


Actual behavior:


The braille display continues to show "Display is 0".
There are two problems with this:

1.	As you type (without using speech) you cannot verify what you just entered.
2.	Once the result appears, you cannot read it unless you temporarily move the focus away from the display and back again.


Expected behavior:


The braille display shows each number, operator and result as you type.


System configuration


NVDA installed/portable/running from source:


Installed


NVDA version:


2020.4


Windows version:


Version 10.0.19042 Build 19042


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


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.


Yes, it worked in NVDA 2019.3.


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


Yes


Did you try to run the COM registry fixing tool in NVDA menu / tools?


Yes

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/12268> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB4AXEGTFZZZ4YQYJ5CPLKDTHCFIXANCNFSM42LRJK3Q> .


Hi,

It looks like the accompanying pull request might be one of the last ones from me for now...

To Sean: smoke tests cannot be performed in the upcoming pull request because Calculator is a modern app not included in AppVeyor VM (the VM uses Windows Server 2016 or 2019, which do not come with apps such as Calculator).

Thanks.

Resolving patch:
diff --git a/source/appModules/calculator.py b/source/appModules/calculator.py
--- a/source/appModules/calculator.py
+++ b/source/appModules/calculator.py
@@ -1,5 +1,5 @@
 # A part of NonVisual Desktop Access (NVDA)
-# Copyright (C) 2020 NV Access Limited, Joseph Lee
+# Copyright (C) 2020-2021 NV Access Limited, Joseph Lee
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
@@ -11,6 +11,7 @@
 import queueHandler
 import ui
 import scriptHandler
+import braille
 
 # #9428: do not announce current values until calculations are done in order to avoid repetitions.
 noCalculatorEntryAnnouncements = [
@@ -64,7 +65,10 @@ def event_nameChange(self, obj, nextHandler):
 		self._shouldAnnounceResult = False
 		nextHandler()
 
-	def event_UIA_notification(self, obj, nextHandler, activityId=None, **kwargs):
+	def event_UIA_notification(self, obj, nextHandler, displayString=None, activityId=None, **kwargs):
+		# #12268: for "DisplayUpdated", announce display strings in braille and move on.
+		if activityId == "DisplayUpdated":
+			braille.handler.message(displayString)
 		try:
 			shouldAnnounceNotification = (
 				obj.previous.UIAAutomationId in
@@ -86,7 +90,13 @@ def event_UIA_notification(self, obj, nextHandler, activityId=None, **kwargs):
 			nextHandler()
 
 	# A list of native commands to handle calculator result announcement.
-	_calculatorResultGestures = ("kb:enter", "kb:numpadEnter", "kb:escape")
+	_calculatorResultGestures = (
+		"kb:enter",
+		"kb:numpadEnter",
+		"kb:escape",
+		"kb:delete",
+		"kb:numpadDelete"
+	)
 
 	@scriptHandler.script(gestures=_calculatorResultGestures)
 	def script_calculatorResult(self, gesture):
@@ -100,9 +110,9 @@ def script_calculatorResult(self, gesture):
 		# In redstone, pressing enter does not move focus to equals button.
 		if isinstance(focus, UIA):
 			if focus.UIAAutomationId in ("CalculatorResults", "CalculatorAlwaysOnTopResults"):
-				queueHandler.queueFunction(queueHandler.eventQueue, focus.reportFocus)
+				queueHandler.queueFunction(queueHandler.eventQueue, ui.message, focus.name)
 			else:
 				resultsScreen = api.getForegroundObject().children[1].lastChild
 				if isinstance(resultsScreen, UIA) and resultsScreen.UIAElement.cachedClassName == "LandmarkTarget":
 					# And no, do not allow focus to move.
-					queueHandler.queueFunction(queueHandler.eventQueue, resultsScreen.firstChild.reportFocus)
+					queueHandler.queueFunction(queueHandler.eventQueue, ui.message, resultsScreen.firstChild.name)


Test patch: