-
Notifications
You must be signed in to change notification settings - Fork 65
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
fix: Reduce noise in ChromiumComponentsShouldUseWebScanner rule #931
Conversation
@@ -38,17 +39,19 @@ private static Condition CreateSecondChildCondition() | |||
private static bool MatchOrderInSiblings(IA11yElement e, int index) | |||
{ | |||
if (e == null) throw new ArgumentNullException(nameof(e)); | |||
if (e.Parent == null || e.Parent.Children == null) return false; |
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.
Old code evaluated e.Parent up to 4 times, and e.Parent.Children up to 3 times. Updated code maxes out at once for each.
|
||
var count = (from c in e.Parent.Children |
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.
Old code evaluated e.Parent up to twice. New code maxes out at once.
@@ -66,9 +69,10 @@ private static bool MatchParent(Condition c, IA11yElement e) | |||
{ | |||
if (c == null) throw new ArgumentNullException(nameof(c)); | |||
if (e == null) throw new ArgumentNullException(nameof(e)); | |||
if (e.Parent == null) return false; |
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.
Old code evaluated e.Parent up to twice. New code maxes out at once.
Details
microsoft/accessibility-insights-windows#1625 points out that the
ChromiumComponentsShouldUseWebScanner
rule is flagging items that are outside the context of a web page, which goes against the rule's primary purpose. This change limits theChromiumComponentsShouldUseWebScanner
rule to elements within a HTML document (including the document itself).While working on this, we discovered a bug in WebView2, which is tracked at MicrosoftEdge/WebView2Feedback#3530.
Motivation
Address microsoft/accessibility-insights-windows#1625
Before & after
Text results using Edge
As expected, only the
ChromiumComponentsShouldUseWebScanner
rule is impactedScreenshots using Edge
These screenshots are limited to just the
ChromiumComponentsShouldUseWebScanner
rule:Context
This includes an opportunistic optimization to some of the code in
Relationships
, because the unit test code looked odd with arbitrary multipliers to compensate for hoeRelationships
is coded. This could be a separate PR if that's preferred.Pull request checklist