Skip to content

Refactoring AutomationId at the GetPropertyValue method #6603

@ArtemTatarinov

Description

@ArtemTatarinov

We should consider refactoring the AutomationId property at AccessibleObject class and its descendants. Now 7 descendants of the ControlAccessibleObject class return the Owner.Name value for the AutomationId property at the GetPropertyValue method, and 4 descendants of the AccessibleObject class return AutomationId (which is not virtual now as each class implements it on its own).

We could refactor this property like that:

  • move the AutomationId property to the AccessibleObject class (it will be returned at the GetPropertyValue method here)
  • make it virtual with the default implementation returning a null value
  • keep the current implementations in the 4 classes derived from AO, but mark them as overrides
  • move returning of the Owner.Name to the ControlAccessibleObjectObject class itself to make it universal for all its descendants.

This could be risky since some customers could have automation tests that rely on AutomationId and have custom controls derived from our control class that don't implement custom AutomationIdProperty, but maybe code simplification outweighs the risk and at the worst-case scenario we could just revert the future PR with the single AutomationId refactoring.

Original post: #6429 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions