Rotating user interface element detection
An accessibility test engine can receive the document object model of a webpage and analyze the webpage for compliance with a set of accessibility rules. The test engine analyzes the compliance of a webpage element with accessibility rules in part by identifying the type of element. In the case of a carousel element a multi-prong testing approach can be used to assign a plurality of confidence scores to a webpage element, each confidence score, based on a likely characteristic of a candidate carousel element. A total combined confidence score exceeding a selected threshold can indicate the webpage element is a carousel. Upon identification, the test engine can apply carousel accessibility rules to the element.
1 . A method comprising:
receiving a webpage, and a document object model (DOM) associated with the webpage, the webpage comprising a plurality of webpage elements and the DOM comprising references to the plurality of webpage elements;
analyzing a reference in the DOM for one or more characteristics indicative of a rotating user interface component;
for each characteristic, generating a score, based on a result of analyzing the characteristic;
generating a plurality of scores, based on results of analyzing the characteristics;
combining the plurality of the scores;
when the combined score exceeds a selected threshold, labeling the analyzed reference in the DOM, and the element in the webpage, corresponding to the analyzed reference, as a rotating user interface component; and
applying penalties and bonuses to the combined score, wherein the penalties and bonuses are in part, based on one or more of the context of a DOM container reference element and the size of the DOM container reference element when generated as a user interface element.
2 . The method of claim 1 , further comprising detecting a container reference element in the DOM, wherein the container reference element comprises container children elements.
3 . The method of claim 1 , wherein analyzing a characteristic comprises checking structural indicators of a rotating user interface component, the structural indicators comprising usage of one or more of a class name, an HTML tag or a naming convention in the reference, suggestive of a rotating user interface component.
4 . The method of claim 1 , wherein analyzing a characteristic comprises checking layout and/or overflow parameters and/or behavior of a container reference in the DOM.
5 . The method of claim 1 , wherein analyzing a characteristic comprises checking presence of transformations, transitions and/or animations, along a horizontal axis for children elements of a DOM container reference.
6 . The method of claim 1 , wherein analyzing a characteristic comprises detecting navigation controls inside or near a DOM container reference element.
7 . The method of claim 1 , wherein analyzing a characteristic comprises detecting a spacing pattern comprising an even distribution of children elements of a DOM container element.
8 . The method of claim 1 , wherein analyzing a characteristic comprises detecting visibility toggling behavior by the DOM container reference element and/or the children of the DOM container reference element.
9 . The method of claim 1 , wherein analyzing a characteristic comprises detecting type of event listeners in a DOM container element.
10 . A non-transitory computer storage medium that stores executable program instructions that, when executed by one or more computing devices, configure the one or more computing devices to perform operations comprising:
receiving a webpage, and a document object model (DOM) associated with the webpage, the webpage comprising a plurality of webpage elements and the DOM comprising references to the plurality of webpage elements;
analyzing a reference in the DOM for one or more characteristics indicative of a rotating user interface component;
for each characteristic, generating a score, based on a result of analyzing the characteristic;
generating a plurality of scores, based on results of analyzing the characteristics;
combining the plurality of the scores;
when the combined score exceeds a selected threshold, labeling the analyzed reference in the DOM, and the element in the webpage, corresponding to the analyzed reference, as a rotating user interface component,
applying penalties and bonuses to the combined score, wherein the penalties and bonuses are in part, based on one or more of the context of a DOM container reference element and the size of the DOM container reference element when generated as a user interface element.
11 . The non-transitory computer storage of claim 10 , wherein the operations further comprise detecting a container reference element in the DOM, wherein the container reference element comprises container children elements.
12 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises checking structural indicators of a rotating user interface component, the structural indicators comprising usage of one or more of a class name, an HTML tag or a naming convention in the reference, suggestive of a rotating user interface component.
13 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises checking layout and/or overflow parameters and/or behavior of a container reference in the DOM.
14 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises checking presence of transformations, transitions and/or animations, along a horizontal axis for children elements of a DOM container reference.
15 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises detecting navigation controls inside or near a DOM container reference element.
16 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises detecting a spacing pattern comprising an even distribution of children elements of a DOM container element.
17 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises detecting visibility toggling behavior by the DOM container reference element and/or the children of the DOM container reference element.
18 . The non-transitory computer storage of claim 10 , wherein analyzing a characteristic comprises detecting type of event listeners in a DOM container element.