winforms icon indicating copy to clipboard operation
winforms copied to clipboard

[release/8.0] Allows DataGridView to start row/column on index 1 on Narrator

Open LeafShi1 opened this issue 2 months ago • 3 comments

Backport #10243 to release/8.0

Fixes https://github.com/dotnet/winforms/issues/13994

Proposed changes

  • Creates a new switch System.Windows.Forms.DataGridViewUIAStartRowCountAtOne that allows developers to configure their application to make the starting index of rows/cells in DataGridView to be read by Narrator from 1, instead of 0;
  • Adds checks on rows and cells of DataGridView to see if the switch is true. If true, starting index of rows/cells will be 1, instead of 0.

Customer Impact

  • Developers will be able to configure their WinForms DataGridView rows/cells to be read by Narrator from index 1, instead of 0.

Regression?

  • No

Risk

  • Low

Test methodology

  • Manual testing
  • Unit tests
Microsoft Reviewers: Open in CodeFlow

LeafShi1 avatar Oct 30 '25 02:10 LeafShi1

@KlausLoeffelmann @Shyam-Gupta I'd like you two to weigh in before we take this. It was approved by Tactics, but I realized that this adds the switch which enables the starting count at 1 rather than 0. That's a behavior change, but @LeafShi1 can tell us whether this new behavior is enabled by default or not. The SSMA team would still have to update their app to turn on the feature if I'm not mistaken. We could never turn this on by default, and if they can't enable this, then maybe we don't need it in servicing and they can just take it when they get to migrate from 8->10.

merriemcgaw avatar Nov 21 '25 01:11 merriemcgaw

@LeafShi1 can tell us whether this new behavior is enabled by default or not.

it's enabled by default https://github.com/dotnet/winforms/blob/09c759bdfe30423022c81cf2264e32547e712c26/src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridViewRow.DataGridViewRowAccessibleObject.cs#L138

LeafShi1 avatar Nov 24 '25 02:11 LeafShi1

So, I am confused with this. @merriemcgaw: I did not see your comment before, when I reviewed this. Now that I am reading this, I am wondering: Why should we continue to consider this for servicing?

I have updated the switch to System.Windows.Forms.DataGridViewUIAStartRowCountAtOne and set it as disabled by default.

@Shyam-Gupta @merriemcgaw Please review it again

LeafShi1 avatar Dec 11 '25 02:12 LeafShi1

We could never turn this on by default, and if they can't enable this, then maybe we don't need it in servicing and they can just take it when they get to migrate from 8->10.

@merriemcgaw Could you please confirm if we need to service this change?

Also, while the change is correct, I am a bit confused why did we choose to flip the switch rather than just setting the default value of DataGridViewUIAStartRowCountAtZero to true ?

Shyam-Gupta avatar Dec 16 '25 19:12 Shyam-Gupta

Also, while the change is correct, I am a bit confused why did we choose to flip the switch rather than just setting the default value of DataGridViewUIAStartRowCountAtZero to true ?

Renaming it to DataGridViewUIAStartRowCountAtOne would make the intent clearer. It allows the logic to read naturally:

private static int RowStartIndex =>
    LocalAppContextSwitches.DataGridViewUIAStartRowCountAtOne ? 1 : 0;

LeafShi1 avatar Dec 17 '25 01:12 LeafShi1

As per the discussion with SME Down grading the severity to Sev3. Therefore, we do not need to port the fix to the .NET 8.0 version, and this pull request is being closed.

LeafShi1 avatar Dec 18 '25 01:12 LeafShi1