Repository: nvaccess/nvda

Issue:
double announcement of clock icon in the system tray
**Reported by blindbhavya on 2014-08-03 11:24**
Steps to reproduce
Press Windows + B to go to the System Tray.
Press left arrow (on my machine a single left arrow is enough but maybe on other machines navigating to the cock icon may differ).
Actual Result = clock cock other information
Expected Result = clock other information
Why does NVDA read clock clock twice?



Discussion:
Comment 1 by briang1 on 2014-08-03 11:41
I suspect this does not happen for everyone. I've noticed that some of the icons down in that dusty part of Windows can be affected by others nearby. You are really at the mercy of the  icon designers and how that affects nvda. 
Another aspect is that tooltips and balloons etc, tend to momentarily pop up as one moves around, further confusing the situation.
 Anti virus icons often are animated and this can cause nasty things to happen, or so it seems to me.

Comment 2 by blindbhavya on 2014-08-03 13:55
I don't feel that this is because of the icons surrounding it.
In this case I am simply talking about the clock icon by Microsoft in Windows (7 at least).
The double announcement of clock is not temporary or inconsistent, it is always clock clock!

Comment 3 by jteh on 2014-08-03 22:06
At a guess, this is probably because the name of the icon is Clock, but it also has a role (control type) of clock (rather than button, etc.). In Windows 8.1, the name contains the time and date instead, but so does the value, so you get double speaking of the time and date. It'd be nice to clean this up, but it'll need to be tested on each different version of Windows, since Microsoft apparently don't know how they want to implement it and still haven't managed to get it right. :(

Comment 4 by blindbhavya on 2014-08-04 11:53
Ji.
If this is not very time consuming nd you find some time, I think this is an issue you should fix.
With regards to changing this on each version of Windows, you will not be doing this on Windows Xp right, because I read somewhere that NVDA 2014.2 is leaving support for xp.
Hope this may be fixed soon.

Comment 5 by driemer.riemer@... on 2014-08-05 07:24
Um, I think that you are thinking of jaws 16. I havn't heard that nvda is gonna lose support for xp. 

@derekriemer NVDA is leaving support for Windows XP. Not version 2014.2 though, but 2017.4. :)
@dkager Would you like to be assigned this ticket?
If not, @feerrenrut, should we mark this as a P3/P4?
Which operating systems does this affect? Not Win10 and probably not Win8.1 either.
Based on the ticket body and some of my own testing coupled with your assertion that this does not affect Windows 10, below is a compilation of how the Clock icon fairs on different Windows versions:
* Windows 7 - clock clock {time}
* Windows 8.1 - 22:30, ‎Tuesday, ‎05-‎09-‎2017  clock  22:30, ‎Tuesday, ‎05-‎0
* Windows 10 - All is well.
Someone can probably get the fix from my "RTL marks" PR. I removed it from there because it wasn't related to the issue at hand, but it's still in the commit history.
I think @dkager is referring to this commit: 92931317ec6c7a1260fc6ca61b6060ad092707cb. Anyone who wishes to look into fixing this issue, should consider how they will have it tested across the various versions of windows, and report the results of this testing in the PR. Given the availability of a reference implementation, I will label this with `goodfornewdev`

Resolving patch:
diff --git a/source/NVDAObjects/IAccessible/__init__.py b/source/NVDAObjects/IAccessible/__init__.py
--- a/source/NVDAObjects/IAccessible/__init__.py
+++ b/source/NVDAObjects/IAccessible/__init__.py
@@ -1656,6 +1656,12 @@ class TrayClockWClass(IAccessible):
 	def _get_role(self):
 		return controlTypes.ROLE_CLOCK
 
+	def _get_name(self):
+		# #4364 On some versions of Windows name contains redundant information that is available either in the role or the value, however on Windows 10 Anniversary Update and later the value is empty, so we cannot simply dismiss the name.
+		if super(TrayClockWClass, self).value is None:
+			return super(TrayClockWClass, self).name
+		return None
+
 class OutlineItem(IAccessible):
 
 	def _get_value(self):
@@ -1833,6 +1839,7 @@ def event_alert(self):
 	(None,oleacc.ROLE_SYSTEM_PROPERTYPAGE):"Dialog",
 	(None,oleacc.ROLE_SYSTEM_GROUPING):"Groupbox",
 	("TrayClockWClass",oleacc.ROLE_SYSTEM_CLIENT):"TrayClockWClass",
+	("TrayClockWClass",oleacc.ROLE_SYSTEM_CLOCK):"TrayClockWClass",
 	("TRxRichEdit",oleacc.ROLE_SYSTEM_CLIENT):"delphi.TRxRichEdit",
 	(None,oleacc.ROLE_SYSTEM_OUTLINEITEM):"OutlineItem",
 	(None,oleacc.ROLE_SYSTEM_LIST):"List",


Test patch: