Skip to content

Adding CheckBox control UIA accessibility#3228

Merged
RussKie merged 3 commits intodotnet:masterfrom
M-Lipin:Issue_3227_CheckBox_control_UIA_accessibility
Jun 30, 2020
Merged

Adding CheckBox control UIA accessibility#3228
RussKie merged 3 commits intodotnet:masterfrom
M-Lipin:Issue_3227_CheckBox_control_UIA_accessibility

Conversation

@M-Lipin
Copy link
Contributor

@M-Lipin M-Lipin commented May 6, 2020

Fixes #3227

Proposed changes

  • Adding UIA providers support for CheckBox control.
  • Moving CheckBox control accessible object to a separate file.

Customer Impact

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

image

After

image

Test methodology

  • Manual testing.
  • Unit tests.
  • UI automation tests.

Accessibility testing

  • Inspect tool (need to ensure that Inspect properties are similar to what we had before switching to UIA as well as accessibility actions should work properly: Default action, Toggle action and so on)
  • Accessibility Insights
  • Narrator

Test environment(s)

.NET Core 5.0
Version: 5.0.100-alpha.1.20073.10
Commit: 29f4d693a9
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-alpha1-05536
Host (useful for support):
Version: 5.0.0-alpha.1.20072.3
Commit: c3dc1fdfdc

Microsoft Reviewers: Open in CodeFlow

@M-Lipin M-Lipin requested a review from a team as a code owner May 6, 2020 18:58
@ghost ghost assigned M-Lipin May 6, 2020
Copy link
Contributor

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests

@ghost ghost added the waiting-author-feedback The team requires more information from the author label May 7, 2020
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argument(Null)Exception seems inappropriate for reading a property

Copy link
Contributor

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Jun 1, 2020
@ghost ghost assigned M-Lipin Jun 2, 2020

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked at the available exceptions, and I think it should be ArgumentException

Copy link
Contributor

@RussKie RussKie Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to also add an error message, something like Argument '{0}' cannot be converted to type '{1}'.
Similar to

<data name="Argument_InvalidValueType2" xml:space="preserve">
<value>Argument '{0}' cannot be converted to type '{1}'.</value>
</data>

Suggested change
public CheckBoxAccessibleObject(CheckBox owner) : base(owner)
public CheckBoxAccessibleObject(Control owner)
: base((owner as CheckBox) ?? throw new ArgumentException(string.Format(SR.Argument_InvalidValueType, nameof(Owner), typeof(CheckBox)), nameof(Owner)))

Copy link
Contributor

@weltkante weltkante Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you don't want to let the compiler do the work of ensuring the type (by declaring the argument type CheckBox and just doing a null check) ?

Declaring the argument type Control but throwing on anything but a CheckBox seems weird.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we would force CheckBox owner, however unlike many other accessibility API, this one is a public API, and changing type would be a breaking change. Granted it won't properly work with any other type, but this seems to be a lesser breaking change.

Copy link
Contributor

@weltkante weltkante Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, didn't notice that, yes changing the signature of a public API will cause MethodNotFound when you run a 3.x program on the 5.0 runtime (a secenario that was declared as desirable in previous discussions)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I made the same mistake 3 hours earlier, and then Mikhail alerted me to the same fact.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has to be a pretty important reason to break the API surface. I can't even come up with a hypothetical case where we would (security perhaps, but I can't imagine a way we couldn't address a security problem that requires us to change the surface area).

Copy link
Contributor

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@RussKie
Copy link
Contributor

RussKie commented Jun 2, 2020

Please rework the PR in the following manner:

  1. First commit - move CheckBoxAccessibleObject to own file, no other changes
  2. Add required changes to CheckBoxAccessibleObject. Please observe the file organisation, it is described here: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md (we'll turn this rule on at some point).

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch from 733b49e to b4d6c65 Compare June 3, 2020 11:32
@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #3228 into master will decrease coverage by 27.96536%.
The diff coverage is 0.00000%.

@@                 Coverage Diff                  @@
##              master       #3228          +/-   ##
====================================================
- Coverage   62.14766%   34.18230%   -27.96537%     
====================================================
  Files           1257         891         -366     
  Lines         449428      253798      -195630     
  Branches       39227       36786        -2441     
====================================================
- Hits          279309       86754      -192555     
+ Misses        164638      162283        -2355     
+ Partials        5481        4761         -720     
Flag Coverage Δ
#Debug 34.18230% <0.00000%> (-27.96537%) ⬇️
#production 34.18230% <0.00000%> (+0.84037%) ⬆️
#test ?

Copy link
Contributor

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OwningCheckBox can never be null
Same below

Copy link
Contributor

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@RussKie
Copy link
Contributor

RussKie commented Jun 4, 2020 via email

Copy link
Contributor

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MC, otherwise 👍

@ghost ghost added the waiting-author-feedback The team requires more information from the author label Jun 11, 2020
@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch 2 times, most recently from a641c62 to 38c86e4 Compare June 18, 2020 07:17
@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #3228 into master will decrease coverage by 31.20954%.
The diff coverage is 56.41026%.

@@                 Coverage Diff                  @@
##              master       #3228          +/-   ##
====================================================
- Coverage   66.58991%   35.38037%   -31.20955%     
====================================================
  Files           1338         896         -442     
  Lines         501564      253553      -248011     
  Branches       40847       36764        -4083     
====================================================
- Hits          333991       89708      -244283     
+ Misses        162033      159012        -3021     
+ Partials        5540        4833         -707     
Flag Coverage Δ
#Debug 35.38037% <56.41026%> (-31.20955%) ⬇️
#production 35.38037% <56.41026%> (+0.01720%) ⬆️
#test ?

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch from 38c86e4 to 9304099 Compare June 24, 2020 14:14
Copy link
Contributor

@vladimir-krestov vladimir-krestov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code style issues

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch 4 times, most recently from d083f46 to 32070ac Compare June 26, 2020 14:18
@SergeySmirnov-Akvelon SergeySmirnov-Akvelon added waiting-review This item is waiting on review by one or more members of team and removed waiting-author-feedback The team requires more information from the author labels Jun 26, 2020
@RussKie RussKie added the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jun 29, 2020
RussKie
RussKie previously approved these changes Jun 29, 2020
@RussKie RussKie removed the waiting-review This item is waiting on review by one or more members of team label Jun 29, 2020
@SergeySmirnov-Akvelon
Copy link
Contributor

Issue has been tested, but another one has been found in Narrator, so i will investigate it

@SergeySmirnov-Akvelon
Copy link
Contributor

CTI approved

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon removed the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jun 30, 2020
@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch from 6c25ae3 to 2afb6ab Compare June 30, 2020 09:05
@RussKie
Copy link
Contributor

RussKie commented Jun 30, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Issue is reproduced because we used incorrect propertyId. We should use the NamePropertyId instead of the ToggleToggleStatePropertyId.
@SergeySmirnov-Akvelon SergeySmirnov-Akvelon force-pushed the Issue_3227_CheckBox_control_UIA_accessibility branch from 2afb6ab to ca99ed0 Compare June 30, 2020 11:44
@codecov
Copy link

codecov bot commented Jun 30, 2020

Codecov Report

Merging #3228 into master will increase coverage by 31.50229%.
The diff coverage is 100.00000%.

@@                 Coverage Diff                  @@
##              master       #3228          +/-   ##
====================================================
+ Coverage   66.99234%   98.49463%   +31.50229%     
====================================================
  Files           1348         452         -896     
  Lines         505822      252829      -252993     
  Branches       40904        4167       -36737     
====================================================
- Hits          338862      249023       -89839     
+ Misses        161389        3092      -158297     
+ Partials        5571         714        -4857     
Flag Coverage Δ
#Debug 98.49463% <100.00000%> (+31.50229%) ⬆️
#production ?
#test 98.49463% <100.00000%> (+0.00947%) ⬆️

@RussKie RussKie merged commit 4c1c9d6 into dotnet:master Jun 30, 2020
@RussKie RussKie deleted the Issue_3227_CheckBox_control_UIA_accessibility branch June 30, 2020 12:05
@ghost ghost added this to the 5.0 Preview8 milestone Jun 30, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CheckBox control does not support UIA accessibility

7 participants