Skip to content

Commit 23f31aa

Browse files
author
msftbot[bot]
authored
Changing DataGridItemAutomationPeer::GetNameCore & fixing DATAGRIDROWHEADER_stateNormalEditingRowFocused typo (#3366)
Fixes #3355 - Fixes a typo in the DataGrid's row header NormalEditingRowFocused state - there was an incorrect space in the name. Also regarding Issue #3079, I improved the experience navigating through cells/rows with Narrator using the Caps Lock + Arrow keys. Instead of "Selected" / "Not Selected", Narrator will say "Row" "Selected" / "Row" "Not Selected" when visiting a row. Use the Caps Lock + Right Arrow for instance to experience this. The relevant change was made in DataGridItemAutomationPeer::GetNameCore. ## PR Type What kind of change does this PR introduce? - Bugfix ## What is the current behavior? The NormalEditingRow state was not entered. This was not detected earlier because row headers have no visuals by default. ## What is the new behavior? The NormalEditingRow state is entered. ## PR Checklist Please check if your PR fulfills the following requirements: - [X] Tested code with current [supported SDKs](../readme.md#supported) - [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link --> - [ ] Sample in sample app has been added / updated (for bug fixes / features) - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) - [ ] Tests for the changes have been added (for bug fixes / features) (if applicable) - [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [X] Contains **NO** breaking changes ## Other information Regarding Issue #3079: - I am adding a few commented out logs in the automation files for future debugging. - I did not see any behavior difference between a retail and debug version of the product. - I installed and ran "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" as instructed but could not get the app's test to run. - I installed and used "Accessibility Insights for Windows" - it will show "data item - 'row'" for the currently hovered row.
2 parents a294b85 + 4f2e313 commit 23f31aa

12 files changed

+68
-14
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridAutomationPeer.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
// #define DEBUG_AUTOMATION
65
using System.Collections.Generic;
76
using System.Diagnostics;
87
using Microsoft.Toolkit.Uwp.UI.Controls;
@@ -184,7 +183,11 @@ protected override IList<AutomationPeer> GetChildrenCore()
184183
/// <returns>The string that contains the name.</returns>
185184
protected override string GetClassNameCore()
186185
{
187-
return Owner.GetType().Name;
186+
string classNameCore = Owner.GetType().Name;
187+
#if DEBUG_AUTOMATION
188+
Debug.WriteLine("DataGridAutomationPeer.GetClassNameCore returns " + classNameCore);
189+
#endif
190+
return classNameCore;
188191
}
189192

190193
/// <summary>
@@ -212,6 +215,10 @@ protected override string GetNameCore()
212215
}
213216
}
214217

218+
#if DEBUG_AUTOMATION
219+
Debug.WriteLine("DataGridAutomationPeer.GetNameCore returns " + name);
220+
#endif
221+
215222
return name;
216223
}
217224

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridCellAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
107107
/// <returns>The string that contains the name.</returns>
108108
protected override string GetClassNameCore()
109109
{
110-
return Owner.GetType().Name;
110+
string classNameCore = Owner.GetType().Name;
111+
#if DEBUG_AUTOMATION
112+
System.Diagnostics.Debug.WriteLine("DataGridCellAutomationPeer.GetClassNameCore returns " + classNameCore);
113+
#endif
114+
return classNameCore;
111115
}
112116

113117
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeaderAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
5050
/// <returns>The string that contains the name.</returns>
5151
protected override string GetClassNameCore()
5252
{
53-
return Owner.GetType().Name;
53+
string classNameCore = Owner.GetType().Name;
54+
#if DEBUG_AUTOMATION
55+
System.Diagnostics.Debug.WriteLine("DataGridColumnHeaderAutomationPeer.GetClassNameCore returns " + classNameCore);
56+
#endif
57+
return classNameCore;
5458
}
5559

5660
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeadersPresenterAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
3737
/// <returns>The string that contains the name.</returns>
3838
protected override string GetClassNameCore()
3939
{
40-
return Owner.GetType().Name;
40+
string classNameCore = Owner.GetType().Name;
41+
#if DEBUG_AUTOMATION
42+
System.Diagnostics.Debug.WriteLine("DataGridColumnHeadersPresenterAutomationPeer.GetClassNameCore returns " + classNameCore);
43+
#endif
44+
return classNameCore;
4145
}
4246

4347
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridDetailsPresenterAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
3737
/// <returns>The string that contains the name.</returns>
3838
protected override string GetClassNameCore()
3939
{
40-
return this.Owner.GetType().Name;
40+
string classNameCore = Owner.GetType().Name;
41+
#if DEBUG_AUTOMATION
42+
System.Diagnostics.Debug.WriteLine("DataGridDetailsPresenterAutomationPeer.GetClassNameCore returns " + classNameCore);
43+
#endif
44+
return classNameCore;
4145
}
4246

4347
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridGroupItemAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ protected override IList<AutomationPeer> GetChildrenCore()
200200
/// <returns>The string that contains the name.</returns>
201201
protected override string GetClassNameCore()
202202
{
203-
return this.OwningRowGroupHeaderPeer != null ? this.OwningRowGroupHeaderPeer.GetClassName() : string.Empty;
203+
string classNameCore = this.OwningRowGroupHeaderPeer != null ? this.OwningRowGroupHeaderPeer.GetClassName() : string.Empty;
204+
#if DEBUG_AUTOMATION
205+
Debug.WriteLine("DataGridGroupItemAutomationPeer.GetClassNameCore returns " + classNameCore);
206+
#endif
207+
return classNameCore;
204208
}
205209

206210
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridItemAutomationPeer.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ protected override IList<AutomationPeer> GetChildrenCore()
151151
/// <returns>The string that contains the name.</returns>
152152
protected override string GetClassNameCore()
153153
{
154-
return (this.OwningRowPeer != null) ? this.OwningRowPeer.GetClassName() : string.Empty;
154+
string classNameCore = (this.OwningRowPeer != null) ? this.OwningRowPeer.GetClassName() : string.Empty;
155+
#if DEBUG_AUTOMATION
156+
System.Diagnostics.Debug.WriteLine("DataGridItemAutomationPeer.GetClassNameCore returns " + classNameCore);
157+
#endif
158+
return classNameCore;
155159
}
156160

157161
/// <summary>
@@ -219,11 +223,18 @@ protected override string GetNameCore()
219223
string owningRowPeerName = this.OwningRowPeer.GetName();
220224
if (!string.IsNullOrEmpty(owningRowPeerName))
221225
{
226+
#if DEBUG_AUTOMATION
227+
System.Diagnostics.Debug.WriteLine("DataGridItemAutomationPeer.GetNameCore returns " + owningRowPeerName);
228+
#endif
222229
return owningRowPeerName;
223230
}
224231
}
225232

226-
return string.Empty;
233+
string name = UI.Controls.Properties.Resources.DataGridRowAutomationPeer_ItemType;
234+
#if DEBUG_AUTOMATION
235+
System.Diagnostics.Debug.WriteLine("DataGridItemAutomationPeer.GetNameCore returns " + name);
236+
#endif
237+
return name;
227238
}
228239

229240
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridRowAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
3737
/// <returns>The string that contains the name.</returns>
3838
protected override string GetClassNameCore()
3939
{
40-
return Owner.GetType().Name;
40+
string classNameCore = Owner.GetType().Name;
41+
#if DEBUG_AUTOMATION
42+
System.Diagnostics.Debug.WriteLine("DataGridRowAutomationPeer.GetClassNameCore returns " + classNameCore);
43+
#endif
44+
return classNameCore;
4145
}
4246

4347
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridRowGroupHeaderAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
3737
/// <returns>The string that contains the name.</returns>
3838
protected override string GetClassNameCore()
3939
{
40-
return Owner.GetType().Name;
40+
string classNameCore = Owner.GetType().Name;
41+
#if DEBUG_AUTOMATION
42+
System.Diagnostics.Debug.WriteLine("DataGridRowGroupHeaderAutomationPeer.GetClassNameCore returns " + classNameCore);
43+
#endif
44+
return classNameCore;
4145
}
4246
}
4347
}

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridRowHeaderAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ protected override AutomationControlType GetAutomationControlTypeCore()
4545
/// <returns>The string that contains the name.</returns>
4646
protected override string GetClassNameCore()
4747
{
48-
return Owner.GetType().Name;
48+
string classNameCore = Owner.GetType().Name;
49+
#if DEBUG_AUTOMATION
50+
System.Diagnostics.Debug.WriteLine("DataGridRowHeaderAutomationPeer.GetClassNameCore returns " + classNameCore);
51+
#endif
52+
return classNameCore;
4953
}
5054

5155
/// <summary>

0 commit comments

Comments
 (0)