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

Accessibity (Narrator) support #173

Open
NeomMob opened this issue Jun 5, 2019 · 6 comments
Open

Accessibity (Narrator) support #173

NeomMob opened this issue Jun 5, 2019 · 6 comments

Comments

@NeomMob
Copy link

NeomMob commented Jun 5, 2019

I would like to implement Narrator support in AvalonEdit but I have absolutly no idea where to start. Any pointer?

@sloutsky
Copy link
Contributor

sloutsky commented Nov 4, 2020

One particular puzzling item is automation peer events for the completion list. Any hints/pointers will be very helpful

@guregini
Copy link

@dgrunwald, @christophwille, @mkonicek, @siegfriedpammer, any plans/hints/pointers regarding Narrator/JAWS support (for the completion list)?

@siegfriedpammer
Copy link
Member

I have no experience with JAWS or any other narrator. Would you be able to provide some resources on the topic and then we might be able to add better support to AvalonEdit. From what I can see in the source code, we already have some automation peer support for the text editor itself. Is the completion window the only missing element? I suspect the search panel might need adjustments as well.

Would you be able to gather a list of missing features and bugs? Thanks!

@sloutsky
Copy link
Contributor

We don't use SearchPanel of AvalonEdit - but yes, it may have similar issue.

We could work-around a requirement for IntelliSense support by changing next functions in TextRangeProvider.cs:

           public bool Compare(ITextRangeProvider range)
	{
		TextRangeProvider other = (TextRangeProvider)range;
		// KUSTO addition
		if (textArea.ActiveIntelliSenseAutomationPeer != null)
		{
			Log("{0}.Compare({1}) [ActiveIntelliSenseAutomationPeer != null]= false", ID, other.ID);
			return false;
		}
		
		bool result = doc == other.doc
			&& segment.Offset == other.segment.Offset
			&& segment.EndOffset == other.segment.EndOffset;
		Log("{0}.Compare({1}) = {2}", ID, other.ID, result);
		return result;
	}

           public string GetText(int maxLength)
	{
		Log("{0}.GetText({1})", ID, maxLength);
		// KUSTO addition
		if (textArea.ActiveIntelliSenseAutomationPeer != null)
		{
			var result = textArea.ActiveIntelliSenseAutomationPeer.GetName();
			Log("{0}.GetText({1}) --> {2}", ID, maxLength, result);
			return result;
		}
		if (maxLength < 0)
			return doc.GetText(segment);
		else
			return doc.GetText(segment.Offset, Math.Min(segment.Length, maxLength));
	}

... and by adding a property to TextArea.cs:

        #region Kusto: AutomationPeers for IntelliSense
	/// <summary>
	/// Gets or sets active IntelliSense selection item automation peer
	/// </summary>
	public System.Windows.Automation.Peers.AutomationPeer ActiveIntelliSenseAutomationPeer { get; set; }
	#endregion

Then - we set 'ActiveIntelliSenseAutomationPeer' - with the AutomationPeer of the IntelliSense SelectedItem (and unsetting it when the IntelliSense is hidden).

This works fine with JAWS and Narrator. LMK if you would like me to create a PR with these changes - or if you have other ideas how to resolve it.

@siegfriedpammer
Copy link
Member

siegfriedpammer commented Dec 26, 2021

Thank you for posting this! Yes, I would be interested in reviewing and testing a PR from you @sloutsky. However, I might not be able to focus on this topic until end of January/mid February, fyi.

@sloutsky
Copy link
Contributor

Please see it here:
#332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants