-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing separators from SizeOfSet and PositionInSet counts #2090
Removing separators from SizeOfSet and PositionInSet counts #2090
Conversation
{ | ||
if (item == owner) | ||
{ | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it continue
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, you don't want to skip the owner, you want to stop at the owner (what you actually want to do is visit all items before the owner, so seeing the owner is your signal to end the loop). break is correct.
Fixes #1467
5.0 PR: #1977
Description
Screen readers were reading incorrect values of the number of menu items and their position since we were counting separators as MenuItems in the automation tree.
I filtered for separators in the current MenuItems to fix the SizeOfSet count.
I filtered for separators again for PositionInSet but added a short-circuit to break when you're at the element whose position you're trying to find. This short-circuit was added to not remove separators below the relevant MenuItem from the PositionInSet count.
Customer Impact
Narrator and other screen readers read the wrong values of SizeOfSet and PositioninSet for each individual menu item. This is confusing for users with visual disabilities as they can not accurately tell what is being visually represented on the screen.
Regression
No. This was discovered during accessibility testing on .Net Core 3.0
Risk - Low
The fix is well-contained and has been tested well internally.
We're iterating over the menu items another time in a place where we're already iterating. Running another iteration through an enumerable does invalidate some caching but there doesn't seem to be an obviously better way to make this change. We rejected an approach storing the number of separators in a variable as the memory cost would always be paid and be higher than the time cost of another iteration.