Refactoring AutomationId at the accessible object classes#6641
Refactoring AutomationId at the accessible object classes#6641ArtemTatarinov wants to merge 1 commit intodotnet:mainfrom
Conversation
|
Hi, @Tanya-Solyanik, @dreddy-work, @RussKie, could you please look at this draft PR? |
5c3f18d to
104a504
Compare
104a504 to
e16817c
Compare
|
nit: @ArtemTatarinov - wasn't the intention to remove from ControlAccessibleObject and replace it with |
e16817c to
5c05707
Compare
@Tanya-Solyanik You're absolutely right, fixed it. |
5c05707 to
de44669
Compare
vladimir-krestov
left a comment
There was a problem hiding this comment.
Looks great! But we need to check if adding AutomationId for all controls is correct.
src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs
Outdated
Show resolved
Hide resolved
| InitHandle(ownerControl); | ||
| } | ||
|
|
||
| internal override string AutomationId => Owner.Name; |
There was a problem hiding this comment.
AOs of all controls now will have this behavior, we have to make sure, that it's correct for the rest controls, that weren't implemented.
There was a problem hiding this comment.
I've manually tested with the Inspect tool boths control with AutomationId implemented and not implemented and also checked their behavior before the fix. Looks like behavior isn't changing: if we were returning specific AutomationId, then it will still be returned after the fix. And if there were no AutomationId (returning _ => null at the GetPropertyValue method at the AccessibleObject class), then it won't be after the fix too, because our default implementation of the virtual AutomationId property returns null. But maybe it need some further investigation too.
de44669 to
e4e93fb
Compare
|
@dkazennov - what does inspect display when AccessibleObject returns |
@Tanya-Solyanik For the testing I commented out the override field AutomationId in the ListViewItemBaseAccessibleObject class and tested ListView control. If AutomationId is null then Inspect will display no AutomationId property at all. As for this PR I've finished all necessary unit tests, but I was being unable to push my changes to ArtemTatarinov/winforms fork. I've asked Vladimir for necessary rights. |
|
You may need to push a the changes into your own fork and open a new PR. |
|
I've finished this PR (added unit tests as requested) in new PR from my fork: #7206 |
Fixes #6603
Proposed changes
AutomationIdproperty is moved to theAccessibleObjectbase classnullatAccessibleObjectGetPropertyValuemethod ofAccessibleObjectfor the caseAutomationIdPropertyIdOwner.Nameis moved to theControlAccessibleObjectObjectclass to make it universal for all its descendantsCustomer Impact
Regression?
Risk
Test methodology
Test environment(s)
.NET SDK 7.0.0-preview-2.22103.2
Microsoft Windows [Version 10.0.19043.1466]
Microsoft Reviewers: Open in CodeFlow