Skip to content

Commit

Permalink
feat: Implement TextBoxAutomationPeer
Browse files Browse the repository at this point in the history
  • Loading branch information
morning4coffe-dev authored and MartinZikmund committed Jun 17, 2024
1 parent 9bfa9e9 commit dd78821
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/Uno.UI/UI/Xaml/Automation/Peers/TextBoxAutomationPeer.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
using System.Collections.Generic;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// MUX Reference TextBoxAutomationPeer_Partial.cpp, tag winui3/release/1.4.2
using System.Collections.Generic;
using Microsoft.UI.Xaml.Controls;

namespace Microsoft.UI.Xaml.Automation.Peers
namespace Microsoft.UI.Xaml.Automation.Peers;

/// <summary>
/// Exposes TextBox types to Microsoft UI Automation.
/// </summary>
public partial class TextBoxAutomationPeer : FrameworkElementAutomationPeer
{
public partial class TextBoxAutomationPeer : FrameworkElementAutomationPeer
public TextBoxAutomationPeer(TextBox owner) : base(owner)
{
public TextBoxAutomationPeer(TextBox owner) : base(owner)
{
}
}

protected override string GetClassNameCore()
{
return "RichEditBox";
}
protected override string GetClassNameCore() => nameof(TextBox);

protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Edit;
}
protected override AutomationControlType GetAutomationControlTypeCore()
=> AutomationControlType.Edit;

protected override bool IsControlElementCore()
protected override IEnumerable<AutomationPeer> GetDescribedByCore()
{
if (Owner is TextBox owner)
{
return true;
//UNO TODO Implement TextBoxPlaceholderTextHelper
//IFC_RETURN(TextBoxPlaceholderTextHelper::SetupPlaceholderTextBlockDescribedBy(spOwner));

return base.GetDescribedByCore();
}

// TODO: Add support for PlaceholderText and Label
// Accessibility priority: Name > LabeledBy > Header > PlaceholderText
// LabeledBy: Header, DescribedBy: PlaceholderText
return [];
}
}

0 comments on commit dd78821

Please sign in to comment.