microsoft / accessibility-insights-windows

Accessibility Insights for Windows
https://accessibilityinsights.io
Other
430 stars 102 forks source link

Supporting the ScrollItem pattern in win32 listbox elements #1839

Closed skuskusku closed 5 months ago

skuskusku commented 5 months ago

How to support the ScrollItem pattern in win32 listbox elements

I have an application that uses a standard win32 listbox control from user32 in a dialog. It is filled with unique strings consisting out of country names. If I run an AI4Win test against this dialog, every single listbox item gets a red error bang symbol with the error text being "An element whose parent supports the Scroll pattern must support the ScrollItem pattern" and the proposed fix is "Modify the element (or one of its children) to support the ScrollItem pattern.".

How am I supposed to do this? Is this something I can fix in my code (dunno how..) or maybe a false positive in AI4Win?

Any help appreciated,

-- Stefan

v-viyada commented 5 months ago

@skuskusku I am not able to reproduce this issue. Could you please help in providing sample code and repro steps so that we can investigate this further.

skuskusku commented 5 months ago

@v-viyada I was trying to reproduce this with a minimal sample and first couldn't. Then I found out what the culprit was: I was using MFC and used a class derived from CListBox for that win32 listbox control that called CWnd::EnableActiveAccessibility in its constructor. Calling CWnd::EnableActiveAccessibility enables you to override virtual functions of CWnd such as CWnd::get_accName, which is what I did. For some reason, calling CWnd::EnableActiveAccessibility is enough to reproduce the behaviour I have described. You can close this issue, I will better stick with server annotations for the task at hand. Thank you!

v-viyada commented 5 months ago

Closing as per user confirmation