Skip to content
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

NVDA reads text in a standard WPF text box incorrectly #1412

Open
nvaccessAuto opened this issue Mar 10, 2011 · 11 comments
Open

NVDA reads text in a standard WPF text box incorrectly #1412

nvaccessAuto opened this issue Mar 10, 2011 · 11 comments
Labels
blocked/needs-external-fix bug/double-speaking bug framework/WPF p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.

Comments

@nvaccessAuto
Copy link

Reported by ianr on 2011-03-10 16:42
Windows Presentation Foundation (WPF) is a GUI framework released by Microsoft a few years ago.
I've noticed that in it's standard TextBox control NVDA reads some things incorrectly.
Specifically if I have a multiline textbox and I have text on line 1, an empty line 2, and text on line 3.
When I reach line 2 NVDA will read the contents of line 3, when I reach line 3 it will also read the contents of line 3.
This makes you think that some lines are duplicated when they are actually not.
In braille the second line has 2 extra characters at the front before the contents of line 3.
The first is a space, the second is dots 7 and 8 raised.

I am attaching a test application written in WPF that contains a multiline textbox so you can add your own text and see the results yourself.

The application requires .NET 4 client profile to be installed on your machine.

@nvaccessAuto
Copy link
Author

nvaccessAuto commented Mar 10, 2011

Attachment MultilineTextboxExample.exe added by ianr on 2011-03-10 16:44
Description:

@nvaccessAuto
Copy link
Author

Comment 1 by Bernd on 2013-05-08 16:02
NVDA doesn't read anything in this Application under Windows XPSP3.

@nvaccessAuto
Copy link
Author

Comment 2 by jteh on 2013-05-08 22:50
That's not surprising. .net primarily uses UIA, which isn't supported with NVDA before Windows 7.

@ehollig
Copy link
Collaborator

ehollig commented Jul 18, 2017

CC @jcsteh

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Mar 23, 2018

@ehollig: Could you restore the attachment for this ticket somehow? I'd like to investigate this.

Update: No longer necessary

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Mar 24, 2018

I can reproduce this issue. Furthermore, NVDA doesn't seem to treat pressing space as such, Character echo announces nothing when pressing space.

Developer info for navigator object:
name: u''
role: ROLE_EDITABLETEXT
states: STATE_FOCUSABLE, STATE_FOCUSED
isFocusable: True
hasFocus: True
Python object: <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x05C1BB70>
Python class mro: (<class 'NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA'>, <class 'NVDAObjects.behaviors.EditableTextWithoutAutoSelectDetection'>, <class 'editableText.EditableTextWithoutAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.UIA.UIA'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: ''
location: (112, 135, 509, 311)
value: u'hello!\r\n\r\nHow are you?'
appModule: <'appModuleHandler' (appName u'multilinetextboxexample', process ID 6068) at address 5c0ccb0>
appModule.productName: u'MultilineTextboxExample'
appModule.productVersion: u'1.0.0.0'
TextInfo: <class 'NVDAObjects.UIA.UIATextInfo'>
windowHandle: 8980904
windowClassName: u'HwndWrapper[MultilineTextboxExample.exe;;3a67925d-d7d6-421f-8ce7-ec7a2a6b7c39]'
windowControlID: 0
windowStyle: 382664704
windowThreadID: 2252
windowText: u'Multiline Textbox Example'
displayText: u''
UIAElement: <POINTER(IUIAutomationElement) ptr=0x107e0e08 at 5e6fad0>
UIA automationID: tbMain
UIA frameworkID: WPF
UIA runtimeID: (7, 6068, 8274172)
UIA providerDescription: [pid:6068,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]
UIA className: TextBox
UIA patterns available: LegacyIAccessiblePattern, SynchronizedInputPattern, ScrollPattern, TextPattern, ValuePattern

Additional interesting findings:

>>> t=nav.makeTextInfo("all")
>>> t.text
u'hello!\r\n\r\nHow are you?'
>>> t.collapse()
>>> t.expand("line")
>>> t.text
u'hello!'
>>> t.move("line",1)
1
>>> t.expand("line")
>>> t.text
u'\r\nHow are you?'
>>> t.move("line",1)
1
>>> t.expand("line")
>>> t.text
u'How are you?'

@origine999
Copy link

This still repros. I have a WPF Reddit client, my NVDA users are pretty unhappy about the NVDA support, because lines in the textbox are read twice most of the time (whenever you have 2+ \r\n, which happens very often). I tried to find a workaround, but nothing worked. I tried different WPF controls, I tried different line endings, nothing fixes the issue.

@seanbudd seanbudd added p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority bug/double-speaking triaged Has been triaged, issue is waiting for implementation. blocked/needs-technical-investigation Issue is blocked. A technical investigation is required to progress the issue. framework/WPF labels Oct 10, 2022
@codeofdusk
Copy link
Contributor

I looked into this a bit with @origine999 today. Based on my testing, it appears that in some WPF controls, the UIA provider's expand method does not work as expected.

In an affected control, move the system caret to a blank line before a line of text. NVDA announces the line of text after the current caret position, even though the line is blank. Then:

ti = nav.makeTextInfo("caret")  # degenerate UIA selection
ti.expand("character")
ti.text  # Returns "\r\n"
ti.collapse()  # make range degenerate (move end to start)
ti.expand("word")
ti.text  # Returns "\r\n"
ti.collapse()
ti.expand("line")
ti.text  # Returns "\r\n" followed by the next line of text
ti.collapse()
ti.move("line", 1)
ti.text  # Returns the next line of text

This is not an NVDA issue and should be fixed on the WPF side.

@seanbudd seanbudd added blocked/needs-external-fix and removed blocked/needs-technical-investigation Issue is blocked. A technical investigation is required to progress the issue. labels Oct 11, 2022
@seanbudd
Copy link
Member

Thanks @codeofdusk - has this been reported anywhere publicly?

@codeofdusk
Copy link
Contributor

I'm guessing that the bugtracker for this wouldn't be public, but I'll see if I can provide an (internal) bug number for tracking.

@origine999
Copy link

@seanbudd @codeofdusk I filed an issue on WPF's GitHub: dotnet/wpf#7190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/needs-external-fix bug/double-speaking bug framework/WPF 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
Development

No branches or pull requests

6 participants