How to use with screen reader

Posted 2 years ago by Avatar Mike Dempsey - Sr. Developer, Teradata Corp

I am having trouble getting a SyntaxEditor control to work with screen readers such as Narrator or JAWS.

It announces the name of the window when focus is moved to the control but it does not read the text.

I tried specifically setting AccessibilityRole =  AccessibilityRole.Text just in case that was not the default, or in case my derived control somehow overrode the setting, but it still doesn't work.

Is there something else I need to do to make Syntax Editor work with screen readers?

Comments (5)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Mike,

While our other SyntaxEditor implementations on XAML-based platforms support UIA and retrieving its value, the WinForms version doesn't at this time.  That's why it's not showing up for screen readers.  You would probably need to inherit the SyntaxEditor control and add accessibility support to support screen reading.

Actipro Software Support
Posted 2 years ago by Mike Dempsey - Sr. Developer, Teradata Corp

Since you have implemented it in the XAML version perhaps you can answer a question for me.

I already have my own control derived from SyntaxEditor and I already use OnSelectionChanged() to determine the line number and display that on the status bar.

I can easily add a 'previousLine' field so that i can track when the line changes and set AccessibleDescription to the text of the new line.

But the only way I know to make a text reader pay attention to the changed value is to perform a focus shift - I move focus to my parent and immediately back again.

I'm sure there must be a better way to inform the reader that I have updated the text. How do you guys do it?

Thanks, Mike.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Mike,

In the other XAML-based platforms, implementing UIA support is pretty straightforward and there's a decent set of automation peer classes and interfaces you can take part of to support various features like control value retrieval, etc.  In WinForms, everything seems to be completely different.

From what I gather looking at WinForms API, it seems like you might need to set an AccessibleObject and then perhaps update its string Value property?  I'm not sure if there is a better way though.

Actipro Software Support
Posted 2 years ago by Mike Dempsey - Sr. Developer, Teradata Corp

I have added basic support but I am having 2 issues:

1. Performance when speaking character by character. (right/left arrow)
    I could move through the caracters much faster in my old editor without 'dropping' letters. 

2. Spurious extra text that gets read when it shouldn't be.
    One example is Ctrl+ right/left arrow says 'one <word>' instead of just '<word>'.
    (I do not have any object in the heirachy with a name/description of 'one' so I dont know where that comes from.) 

I am handling OnEnter and OnKeyUp but I suspect I may need to handle other events in order to supress the 'extra' text.

Is it possible you could make your event handler code [related to screen readers] from the XAML product available so that I can duplicate it in Windows Forms?


Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Mike,

I might be wrong but I don't think there is really any overlap whatsoever API-wise with the WPF and WinForms implementations of UIA.  Even if there was, the SyntaxEditor APIs in those two platforms are very different.  Thus I don't think any code there would help you in any way.

In WPF, we can make automation peer classes for controls/elements that can implement certain Microsoft-defined interfaces as appropriate.  Our SyntaxEditor automation peer implements their IValueProvider and ITextProvider interfaces.  My guess is that their ITextProvider interface is what screen readers interact with, since that has a method that returns the visible text ranges upon request.  And those results allow access to text.

All our code for that sort if thing is using the editor view and document text APIs that are publicly available.

Actipro Software Support
Information The latest build of this product (2018.1 build 0341) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.