Skip to content

Filter LTR and RTL marks from list view items#5751

Merged
feerrenrut merged 17 commits into
nvaccess:masterfrom
dkager:i5729
May 6, 2018
Merged

Filter LTR and RTL marks from list view items#5751
feerrenrut merged 17 commits into
nvaccess:masterfrom
dkager:i5729

Conversation

@dkager

@dkager dkager commented Feb 13, 2016

Copy link
Copy Markdown
Contributor

Update: see #5751 (comment) for a better summary of what this does.

Related issues: #5729, #4364

This extends NVDAObjects.IAccessible.TrayClockWClass to also cover recent versions of Windows. It does two things:

  1. Filters out the Unicode character U+200E (left-to-right mark). Question: should U+200F (right-to-left) also be filtered?
  2. Discards the object name (see the commit for details).

In #5729 I said I would rather implement this in the Explorer app module, but in the end that got a bit confusing so I changed my mind. All suggestions and comments are appreciated as always.

Tested on Windows 7 and Windows 10. I tried to test on XP but the launchers I built crashed after initializing comtypes.

… included in the value on recent versions of Windows. This character is usually not defined in the liblouis braille tables. re nvaccess#5729
On Windows 7 the name is "Clock", same as the role. On Windows 10 the name equals the value. Both situations cause repeated announcements in NVDA.
On Windows XP the clock has no value and the name only contains the time. Use this for its value since that is what is used on newer versions of Windows.
re nvaccess#4364
@dkager

dkager commented Feb 24, 2016

Copy link
Copy Markdown
Contributor Author

Ugh, this character (U+200e) is also shown in the Details view of Windows Explorer in the Date modified column. Would be nice to get rid of it there too since it gets in the way of reading file dates.

@dkager

dkager commented Feb 27, 2016

Copy link
Copy Markdown
Contributor Author

Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer.

It looks like this was addressed before, see ListItemWithoutColumnSupport._get_value. The ListItem class inherits from it, but there the value is explicitly set to None and a dynamic value is exposed through _get_name. This should probably also deal with the annoying LTR/RTL marks. Hopefully that is the last case I will find... An updated patch will follow.

@josephsl

Copy link
Copy Markdown
Contributor

Hi, is this still the case on Windows 7/8.1 with 2016.1? Thanks.

From: Davy Kager [mailto:notifications@github.com]
Sent: Saturday, February 27, 2016 6:47 AM
To: nvaccess/nvda nvda@noreply.github.com
Subject: Re: [nvda] Improve reading of the clock in the taskbar (#5751)

Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer.

It looks like this was addressed before, see ListItemWithoutColumnSupport._get_value. The ListItem class inherits from it, but there the value is explicitly set to None and a dynamic value is exposed through _get_name. This should probably also deal with the annoying LTR/RTL marks. Hopefully that is the last case I will find... An updated patch will follow.


Reply to this email directly or view it on GitHub #5751 (comment) .

@dkager

dkager commented Feb 27, 2016

Copy link
Copy Markdown
Contributor Author

I don’t know about 7, but it is on 10.

From: josephsl [mailto:notifications@github.com]
Sent: Saturday, February 27, 2016 17:32
To: nvaccess/nvda nvda@noreply.github.com
Cc: Davy Kager mail@davykager.nl
Subject: Re: [nvda] Improve reading of the clock in the taskbar (#5751)

Hi, is this still the case on Windows 7/8.1 with 2016.1? Thanks.

From: Davy Kager [mailto:notifications@github.com]
Sent: Saturday, February 27, 2016 6:47 AM
To: nvaccess/nvda <nvda@noreply.github.com mailto:nvda@noreply.github.com >
Subject: Re: [nvda] Improve reading of the clock in the taskbar (#5751)

Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer.

It looks like this was addressed before, see ListItemWithoutColumnSupport._get_value. The ListItem class inherits from it, but there the value is explicitly set to None and a dynamic value is exposed through _get_name. This should probably also deal with the annoying LTR/RTL marks. Hopefully that is the last case I will find... An updated patch will follow.


Reply to this email directly or view it on GitHub #5751 (comment) .


Reply to this email directly or view it on GitHub #5751 (comment) . https://github.com/notifications/beacon/AC9y8WLppP2g_d9HTb6N5QP-w0BsldvPks5pocbzgaJpZM4HZsGx.gif

@dkager

dkager commented Feb 28, 2016

Copy link
Copy Markdown
Contributor Author

The commits I just pushed should fix all cases of this problem reported thus far. Tested on Windows 10 and XP so far.

if value is None:
#On XP there is no value, fall back to using the name.
return super(TrayClockWClass, self).name
#Strip Unicode left-to-right and right-to-left marks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think referencing a ticket might help future devs to find out why the below code is necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will add that.

From: josephsl [mailto:notifications@github.com]
Sent: Sunday, April 3, 2016 10:12
To: nvaccess/nvda nvda@noreply.github.com
Cc: Davy Kager mail@davykager.nl
Subject: Re: [nvaccess/nvda] Improve reading of the clock in the taskbar (#5751)

In source/NVDAObjects/IAccessible/init.py #5751 (comment) :

  """

  def _get_role(self):
         return controlTypes.ROLE_CLOCK
  • def _get_name(self):
    
  •        #The name contains redundant information that is available either in the role or the value.
    
  •        return None
    
  • def _get_value(self):
    
  •        value = super(TrayClockWClass, self).value
    
  •        if value is None:
    
  •                #On XP there is no value, fall back to using the name.
    
  •                return super(TrayClockWClass, self).name
    
  •        #Strip Unicode left-to-right and right-to-left marks.
    

I think referencing a ticket might help future devs to find out why the below code is necessary.


You are receiving this because you authored the thread.
Reply to this email directly or https://github.com/nvaccess/nvda/pull/5751/files/19b600d36da6a6f2557663dc605a251fad2086c6#r58306141 view it on GitHub https://github.com/notifications/beacon/AC9y8fJ8BqF7uVD9EksepuqFARlO3zU-ks5pz3ZAgaJpZM4HZsGx.gif

@josephsl

josephsl commented Apr 3, 2016

Copy link
Copy Markdown
Contributor

Did some code review. Looks fine to me (so far). If we can get a confirmation that this is working in Windows 7 and 8.x, then I'd like to request incubating this pull request. Thanks.

@dkager

dkager commented Jun 7, 2016

Copy link
Copy Markdown
Contributor Author

Recently I found out that the RSS feed view in IE11 also contains these marks. However, I think it goes too far to catch those too. Instead, I would like to suggest that we discard these characters in standard Windows widgets as this PR aims to do, and leave the rest up to braille table developers. There is always going to be just one more case we missed.

@derekriemer

Copy link
Copy Markdown
Collaborator

Would braille dictionaries (Something I didn't get around to doing) fix this?

@dkager

dkager commented Dec 1, 2016

Copy link
Copy Markdown
Contributor Author

Would braille dictionaries (Something I didn't get around to doing) fix this?
Possibly, but apparently this work-around has already been implemented elsewhere (in MSAA lists if I remember right). The problem also shows up in speech if you go charcter by character, or at least I would assume so.

One complication is that the clock changes almost with every iteration of Windows, including Windows 10 Anniversary Update.

@dkager

dkager commented Jan 18, 2017

Copy link
Copy Markdown
Contributor Author

@feerrenrut Any thoughts on usefulness/priority of this?

@jcsteh

jcsteh commented Jan 20, 2017

Copy link
Copy Markdown
Contributor

I'm now somewhat unclear as to what this PR does; i.e. exactly what controls it touches and what it does. For example, you mention discarding the object name, but at least on Windows 10 build 14971, discarding the name of the clock in the system tray would mean we lose the information altogether. Can you please provide a summary of what this fixes from a user perspective? Thanks.

@dkager

dkager commented Jan 20, 2017

Copy link
Copy Markdown
Contributor Author

I'm now somewhat unclear as to what this PR does; i.e. exactly what controls it touches

It touches:

  • System tray clock controls, which already had a class defined in NVDAObjects.
  • List view items, which already filter out the LTR/RTL marks.
  • Windows Explorer Details view rows, where these characters also show up.

As such the PR is a misnomer. It really is about filtering the LTR/RTL marks found in e.g. the clock. These are usually not spoken, but they are brailled and also spoken when you go character-by-character.
It should be noted that there are more of these symbols (U+202A, U+202B, etc). Some of these also appear in Windows, but the PR doesn't touch them.

example, you mention discarding the object name, but at least on Windows 10 build 14971, discarding the name of the clock in the system tray would mean we lose the information altogether.

The code uses the object's value but falls back to the name if there is no value. I think I did this to avoid having to filter LTR/RTL marks from both name and value, depending on the OS in use.
This is only done for the TrayClockWClass window class. In Windows 10 Anniv Update the clock is a button instead of a clock widget, because that totally makes sense, so this code doesn't apply at all.

Can you please provide a summary of what this fixes from a user perspective?

For example, in Windows Explroer, this changes the way a date is brailled from:
'\x200e'18-'\x200e'Mar-'\x200e'2016 '\x200f''\x200e'12:53
To:
18-Mar-2016 12:53

@dkager dkager changed the title Improve reading of the clock in the taskbar Filter RTL and RTL marks from the clock and list view items Jan 20, 2017
dkager added 2 commits April 25, 2017 16:29
… that is included in the value on recent versions of Windows. This character is usually not defined in the liblouis braille tables. re nvaccess#5729"

This reverts commit 6a16a24.
@dkager dkager changed the title Filter RTL and RTL marks from the clock and list view items Filter RTL and RTL marks from list view items Apr 25, 2017
@dkager

dkager commented Apr 25, 2017

Copy link
Copy Markdown
Contributor Author

@jcsteh looks like this PR is quite old. I simplified it a bit. Now it only touches list view item and items in Windows Explorer details view.
The comments in the code should explain the motivation. Could we decide on the faith of this humble patch?

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I think this looks good

if not value:
return None
#Some list view items in Vista can contain annoying left-to-right and right-to-left indicator characters which really should not be there.
#Some list view items in Vista and later can contain annoying left-to-right and right-to-left indicator characters which really should not be there.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vista support is no more, so you could consider changing this to 7...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For historical tracking, I'd rather keep it this way. It is good to know when this behavior started.

Comment thread source/appModules/explorer.py Outdated

def _get_value(self):
value = super(UIProperty, self).value
return value.replace(u'\u200E','').replace(u'\u200F','')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well use translate here, as @jcsteh suggested

Comment thread source/appModules/explorer.py Outdated
if role == controlTypes.ROLE_LIST:
clsList.remove(List)
clsList.insert(0, StartButton)
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's this one coming from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this short-circuits the function to avoid doing a bunch of checks that won't lead to any more code being executed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here to explain this? When maintaining this code, it will be important to know that the early return here is purely an optimisation, and not functional. I guess something along the lines of: "Because the windowClass is start, and role is either list or button, none of the checks after this will apply, so we can return early"

@dkager

dkager commented Feb 1, 2018

Copy link
Copy Markdown
Contributor Author

Can you add a comment here to explain this? When maintaining this code, it will be important to know that the early return here is purely an optimisation, and not functional.

Yes, I can add a comment, but there are a number of similar checks with return above that one. I think we need a generic comment at the top of the function.

@dkager dkager left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed the review comments.

Comment thread source/appModules/explorer.py Outdated
clsList.insert(0,MultitaskingViewFrameWindow)
elif obj.windowClassName=="MultitaskingViewFrame" and role==controlTypes.ROLE_LISTITEM:
clsList.insert(0,MultitaskingViewFrameListItem)
elif uiaClassName=="MultitaskingViewFrame":

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feerrenrut @LeonarddeR While this seems logical I'd like your expert opinion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this as long as you manually confirm that uiaClassName is equal to obj.windowClassName when looking at the "MultitaskingViewFrame"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug a bit deeper in the code and reverted this change. However, while reading the function I also tried to improve readability and consistency of code style a bit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you found out why, could you add a comment here about why this one uses windowClassName rather than uiaClassName?

@dkager dkager changed the title Filter RTL and RTL marks from list view items Filter LTR and RTL marks from list view items Feb 1, 2018
Comment thread source/appModules/explorer.py Outdated
class AppModule(appModuleHandler.AppModule):

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
# Optimization: return early to avoid comparing class names and roles that will never match.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with this, is that we don't know which returns are purely optimisation, and which are functional, if any. Perhaps there is no easy way to convey this information, and someone intending to modify this function will have to work it out. If there was a way that was not overly verbose, it would reduce the maintenance cost of this function.

states.discard(controlTypes.STATE_SELECTED)
return states

CHAR_LTR_MARK = u'\u200E'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if this file and the other could refer to the same constants.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explorer app module imports SysListView32, but it seems ugly to put the constants there. Still, I see no other options that look much better. Should we go for it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree that isn't much better. Really, a unicode constants file would be handy. Leave it as is for now.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

@dkager: is this ready for another review by @feerrenrut?

@dkager

dkager commented Mar 3, 2018

Copy link
Copy Markdown
Contributor Author

YEs, I addressed all the reviews I am aware of.

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll go ahead and incubate this.

feerrenrut added a commit that referenced this pull request Apr 11, 2018
Merge remote-tracking branch 'origin/pr/5751' into next
@lallerke1

Copy link
Copy Markdown

if it appeared in next, control panel in anniversary fall update stopped speaking

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I have a commit for this, but I'm afraid @dkager doesn't allow me to push it ;)

@lallerke1

lallerke1 commented Apr 11, 2018 via email

Copy link
Copy Markdown

@LeonarddeR

Copy link
Copy Markdown
Collaborator

@lallerke1 commented on 11 Apr 2018, 15:59 CEST:

why not? He sems a good person

Sure, he's a tough guy! Just did not check the checkbox that allows maintainers to push commits to a pull request repository.

@dkager

dkager commented Apr 11, 2018

Copy link
Copy Markdown
Contributor Author

I had a typo that @LeonarddeR fearlessly fixed.

michaelDCurran added a commit that referenced this pull request Apr 11, 2018
@feerrenrut feerrenrut merged commit f5bc848 into nvaccess:master May 6, 2018
@nvaccessAuto nvaccessAuto added this to the 2018.2 milestone May 6, 2018
feerrenrut added a commit that referenced this pull request May 6, 2018
NVDA no longer reports (LTR and RTL marks) in Braille or per-character speech when accessing the clock in recent versions of Windows.
Issue #5729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants