AvalonEdit
AvalonEdit copied to clipboard
Accessibity (Narrator) support
I would like to implement Narrator support in AvalonEdit but I have absolutly no idea where to start. Any pointer?
One particular puzzling item is automation peer events for the completion list. Any hints/pointers will be very helpful
@dgrunwald, @christophwille, @mkonicek, @siegfriedpammer, any plans/hints/pointers regarding Narrator/JAWS support (for the completion list)?
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!
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.
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.
Please see it here: https://github.com/icsharpcode/AvalonEdit/pull/332