CefSharp icon indicating copy to clipboard operation
CefSharp copied to clipboard

Feature Request - Add WPF Accessibility Support

Open RichiCoder1 opened this issue 7 years ago • 17 comments

The Cef project just recently merged accessibility support of OSR (https://bitbucket.org/chromiumembedded/cef/pull-requests/99/issue-1217-cef3-accessibility-support/diff) and it would be terrific to see that supported in the next version of CefSharp.

RichiCoder1 avatar May 18 '17 15:05 RichiCoder1

https://bitbucket.org/chromiumembedded/cef/commits/406867f293042006e9f5f1a1e5201db012e50adf

amaitland avatar May 20 '17 21:05 amaitland

I might (maybe) be able to pick this up. Not overly familiar with either Cef or CefSharp though. It looks like it's a matter of forwarding accessibility events? (Which I have no idea how to do, but I can at least look into)

RichiCoder1 avatar Jun 08 '17 21:06 RichiCoder1

IBrowserHost.SetAccessibilityState added in commit https://github.com/cefsharp/CefSharp/commit/921ea55fff0495c3e1895d7d4ba694e06163fca3

From a wrapper point of view CefAccessibilityHandler needs to be implemented and IAccessibilityHandler created (same as any of the other handlers)

amaitland avatar Dec 21 '17 23:12 amaitland

What is the status of this? Did commit 921ea55 resolve the issue? If so, why is the CefSharp.Wpf.Example application still inaccesible? Do I need to add a call to the SetAccessibilityState function somewhere?

BenKeyFSI avatar Jun 05 '18 19:06 BenKeyFSI

This issue relates to WPF.

See https://stackoverflow.com/questions/42163764/how-to-make-jaws-screen-reader-recognize-and-read-content-of-cefsharp-chromiumwe for an example of how to get the WinForms version working.

amaitland avatar Jun 05 '18 20:06 amaitland

I meant the CefSharp.Wpf.Example. The Windforms example currently works as is. Unfortunately, the WPF one does not. I have a key client that wants to use CEF in a WPF application with JAWS.

BenKeyFSI avatar Jun 05 '18 20:06 BenKeyFSI

Pull requests welcome

amaitland avatar Jun 05 '18 21:06 amaitland

I would be glad to work on this issue, if it is still open. However, my question regarding the status of this issue has yet to be answered. I have a key client who wants JAWS to be able to work in an application that uses CEF in a WPF application.

I found this search while doing a Google search. I am a little unclear on the status. The last comment before my first comment is a commit message that seems to be related. An yet the issue is still open. Is that because more work needs to be done?

Specifically, I do not understand the following comment.

"From a wrapper point of view CefAccessibilityHandler needs to be implemented and IAccessibilityHandler created (same as any of the other handlers)."

Is this meant to be a description of work that has yet to be done? If so, I will look into it. I cannot guarantee that I will be able to complete the work because I am not all that familiar with C#, but I am willing to try.

So please, amaitland, can you give a slightly more helpful response and answer the following question. Is there more work to be done and is the comment I quoted a description of that work.

BenKeyFSI avatar Jun 05 '18 21:06 BenKeyFSI

I figured it out. I think I can manage the remaining tasks. With a bit of luck, I may be finished by the end of next week.

BenKeyFSI avatar Jun 05 '18 22:06 BenKeyFSI

The issue is open as it still requres someone to put in a large chunk of time.

  • [x] Add interface with xmldoc
  • [x] Add VC++ wrapper class
  • [x] Update ClientAdapter
  • [x] Add the new handler to IRenderWebBrowser
  • [x] Implement the WPF specifics ( I'm guessing a custom AutomationPeer, that's up to you to work out)

Probably a bunch of other steps that I cannot think of right now.

If you can get it implemented by next week then you will have done exceptionally well!

In future please just come straight out and ask what's required, if an issue is open on this issue tracker then it's open for a reason. Thanks!

amaitland avatar Jun 06 '18 08:06 amaitland

I had planed on fixing this. It proved to be more than I can manage at this time. In addition, we found another solution for our client. We suggested they use the WinForms version of CefSharp in their WPF application. This worked.

BenKeyFSI avatar Aug 17 '18 05:08 BenKeyFSI

Part implementation done in #2480

The WPF specifics are yet to be implemented.

amaitland avatar Aug 17 '18 07:08 amaitland

Is there any way to enable accessibility in WpF with cefsharp and do UI automation

nnigam1 avatar Sep 04 '19 12:09 nnigam1

Thanks to @justindarc there is now an experimental readonly implementation. There are obviously limitations as CEF only provides a readonly implementation.

Added in commits https://github.com/cefsharp/CefSharp/commit/e834d89518d3b56055f913a88d5cdbe22fa85c27 and https://github.com/cefsharp/CefSharp/commit/da8ad192a48c94b2076ad5c22fc3e8f8411c7f3b

Example of enabling

//Enable experimental Accessibility support 
browser.AccessibilityHandler = new AccessibilityHandler(browser);
browser.IsBrowserInitializedChanged += (sender, args) =>
{
	if ((bool)args.NewValue)
	{
		browser.GetBrowserHost().SetAccessibilityState(CefState.Enabled);
	}
};

The original commit from @justindarc used System.Drawing assembly to perform a calculation related to positioning when DPI scaling is enabled. We don't reference System.Drawing in the CefSharp.Wpf assembly and rather than include a reference I've used a similar calculation to other DPI scaling code we have internally. This hasn't been tested in the context of the accessibility handler. If you experience any positioning problems then please report back here.

Code change for reference is at https://github.com/cefsharp/CefSharp/commit/da8ad192a48c94b2076ad5c22fc3e8f8411c7f3b#diff-b137532b29cdc092534dc783dffc6a90L306

amaitland avatar Jul 27 '20 10:07 amaitland

Which version have this changes(WPF - Add basic UI Accessibility support. #2495) ? @amaitland if none, please add this feature in latest release @amaitland

schalla1 avatar Sep 24 '20 11:09 schalla1

@schalla1 These changes will be in version 85. If you wish to test this out before 85 is released then you can use a build from https://www.myget.org/feed/cefsharp/package/nuget/CefSharp.Wpf

amaitland avatar Sep 24 '20 22:09 amaitland

@amaitland with latest version of CEF, although CEF with WPF elements are noticeable in inspect tool, NVDA/JAWs are not able to recognize them. Is there any pending bugs that needs to be addressed

vinuthamikkilineni avatar Dec 10 '21 04:12 vinuthamikkilineni