Skip to content

Adding support expand-collapse pattern for DateTimePicker#5245

Merged
dreddy-work merged 1 commit intodotnet:mainfrom
lisoenot:Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control
Aug 23, 2021
Merged

Adding support expand-collapse pattern for DateTimePicker#5245
dreddy-work merged 1 commit intodotnet:mainfrom
lisoenot:Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control

Conversation

@lisoenot
Copy link
Contributor

@lisoenot lisoenot commented Jul 15, 2021

Implemented expand-collapse pattern in DateTimePickerAccessibleObject class

Fixes #4099

Proposed changes

  • Implemented expand-collapse pattern in DateTimePickerAccessibleObject class
  • Added unit tests

Customer Impact

  • Improve user experience
  • Follow accessibility standards

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

  • In the Accessibility Insight tool, an error 'An element of the given ControlType must support the ExpandCollapse pattern' appeared.

image

  • In the inspect tool, the IsExpandCollapsePattermAvaliable property value is false.

dt bf

After

  • In the Accessibility Insight tool, no error 'An element of the given ControlType must support the ExpandCollapse pattern' appeared.

image

  • In the inspect tool, the IsExpandCollapsePattermAvaliable property value is true and the ExpandCollapseExpandCollapseState property appear.

dt after

  • Updated notification in narrator.

nb after

Test methodology

  • Manually test
  • Unit test
  • Accessibility test

Accessibility testing

  • Inspect
  • Narrator
  • Accessibility insight

Test environment(s)

  • .NET SDK: 6.0.0-preview.7.21365.2
Microsoft Reviewers: Open in CodeFlow

@ghost ghost assigned lisoenot Jul 15, 2021
@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch 5 times, most recently from 082f3ce to 2bf9160 Compare July 19, 2021 08:50
@vladimir-krestov vladimir-krestov self-requested a review July 27, 2021 05:12
@vladimir-krestov vladimir-krestov added the 🚧 work in progress Work that is current in progress label Jul 27, 2021
@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch 4 times, most recently from 7a5644b to 067c925 Compare August 2, 2021 15:53
@vladimir-krestov
Copy link
Contributor

            internal override void Expand()
            {
                SendMessageW(Owner, WM.SYSKEYDOWN, (IntPtr)Keys.Down);
            }

            internal override void Collapse()
            {
                SendMessageW(Owner, (WM)DTM.CLOSEMONTHCAL);
            }

@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch from 067c925 to 12e47c9 Compare August 4, 2021 08:21
@lisoenot lisoenot marked this pull request as ready for review August 4, 2021 08:22
@lisoenot lisoenot requested a review from a team as a code owner August 4, 2021 08:22
@dreddy-work dreddy-work modified the milestone: 6.0 Aug 6, 2021
@lisoenot lisoenot added waiting-review This item is waiting on review by one or more members of team and removed 🚧 work in progress Work that is current in progress labels Aug 12, 2021
@lisoenot lisoenot added waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Aug 12, 2021
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Aug 12, 2021
@lisoenot lisoenot added the 🚧 work in progress Work that is current in progress label Aug 12, 2021
@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch 2 times, most recently from 3621a7c to 2358965 Compare August 12, 2021 13:32
@lisoenot lisoenot removed the 🚧 work in progress Work that is current in progress label Aug 12, 2021
@lisoenot lisoenot added 🚧 work in progress Work that is current in progress and removed waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) waiting-review This item is waiting on review by one or more members of team labels Aug 16, 2021
@lisoenot
Copy link
Contributor Author

Fix a test issue is in progress

dreddy-work
dreddy-work previously approved these changes Aug 16, 2021
@RussKie RussKie removed the 🚧 work in progress Work that is current in progress label Aug 17, 2021
@dreddy-work dreddy-work added the 🚧 work in progress Work that is current in progress label Aug 17, 2021
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Looks good, please address the comment about creation on accessible object on raising an event.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please use UiaClientsAreListening API. We should not create accessible object when not required to.

Even though this API returns true in the case of a touch driver, when accessibility tools are not running. Touch driver forces creation of accessibility objects by sending WM_GETOBJECT message, we can treat it as another accessibility tool in regard to creation of Accessibility Objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, we asked Guy Barker about this API, and we were advised it may not work as expected

(us) Q: We have a problem with UiaClientsAreListening() method that works incorrectly. It returns true even there are not any Accessiblity clients (AI, Inspect, Narrator, NVDA, etc.). Tanya asked me to take a look at its implementation in OS. (..snip..)

(GB) A: ...unfortunately UiaClientsAreListening() can't be used to specifically learn whether an assistive technology (AT) like Narrator, Windows Magnifier, or Windows On-Screen Keyboard is running, (those 3 products are all UIA clients). Other UIA clients which aren't AT will also result in UiaClientsAreListening() returning true. UiaClientsAreListening() was first majorly impacted when the touch keyboard was introduced for Windows touch devices. The touch keyboard used UIA and so UiaClientsAreListening() returned true, regardless of whether any AT is running. As far as I know, this is still how things work today.
Again, as far as I know, there is no supported way in Windows to determine that AT is running, or that a specific type of AT like a screen reader is running. (Don't even think about trying to achieve this with the SystemParameterInfo SPI_GETSCREENREADER flag.) Sorry to be the bearer of bad news. You're not the only person who's looking for some way of doing this without checking what exes are running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have any other ideas for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use IsAccessibleObjectCreated property here.
UiaClientsAreListening doesn't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let's try it. If you think it's incorrect, write here please - I will remove it

Copy link
Contributor

Choose a reason for hiding this comment

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

Other UIA clients which aren't AT will also result in UiaClientsAreListening() returning true.

Please clarify why this is a problem?

Other UIA clients are creating AccessibleObjects for their purposes, so AccessibleObject would be created anyway. The goal is to not create the Object unnecessarily, not to raise notification only when "real" AT clients are listening.

Copy link
Contributor Author

@lisoenot lisoenot Aug 20, 2021

Choose a reason for hiding this comment

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

I really like your propose. But I take it UiaClientsAreListening() doesn't work correct now. If we paste method with incorrect realization it would not be good. So I would stay with IsAccessibleObjectCreated method here and try this approach when we will have correct api method.

@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch from 6e46f1c to 283057e Compare August 18, 2021 08:00
Implemented ExpandCollapse pattern in DateTimePickerAccessibleObject class
Added unit tests for this implementation
@lisoenot lisoenot force-pushed the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch from 283057e to b9d9d97 Compare August 18, 2021 08:13
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.

Looks good. Approved.

@dreddy-work
Copy link
Member

@DmitryGorokhov , just need clarification on Tanyas question. otherwise, we are ready to merge this.

@lisoenot
Copy link
Contributor Author

Unfortunately, we didn't find an fast way to implement announcing state on calendar open action. But it is an additional functionality and it doesn't have any high priority for now. So, we decided that we can separate this into other issue. As a result, I've created issue #5487 for this feature.

@lisoenot
Copy link
Contributor Author

@dreddy-work, I guess this pr is ready for merge, you may do it

@lisoenot lisoenot added waiting-review This item is waiting on review by one or more members of team and removed 🚧 work in progress Work that is current in progress labels Aug 20, 2021
@vladimir-krestov vladimir-krestov added the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Aug 23, 2021
@lisoenot
Copy link
Contributor Author

... and I forgot to tell you - testers approved the fix

@dreddy-work dreddy-work merged commit dc90a52 into dotnet:main Aug 23, 2021
@ghost ghost added this to the 7.0 alpha1 milestone Aug 23, 2021
@lisoenot lisoenot deleted the Fix-an-element-of-the-given-ControlType-must-support-the-ExpandCollapse-pattern-for-DateTimePicker-control branch August 24, 2021 07:04
lisoenot added a commit to lisoenot/winforms that referenced this pull request Sep 9, 2021
…t#5245)

Implemented ExpandCollapse pattern in DateTimePickerAccessibleObject class
Added unit tests for this implementation
@ghost ghost locked as resolved and limited conversation to collaborators Jan 27, 2022
@RussKie RussKie removed the waiting-review This item is waiting on review by one or more members of team label Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-merge PRs that are ready to merge but worth notifying the internal team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accessibility] An element of the given ControlType must support the ExpandCollapse pattern for DateTimePicker control

6 participants