@@ -36,25 +36,27 @@ The accessibility tree exposes the heading hierarchy and semantic landmarks.
36363 . ** Orphaned Inputs** : Verify that all form inputs have associated labels. Use ` evaluate_script ` to check for inputs missing ` id ` (for ` label[for] ` ) or ` aria-label ` :
3737 ``` javascript
3838 () => {
39- const inputs = Array .from (
40- document .querySelectorAll (' input, select, textarea' ),
41- );
42- return inputs
43- .filter (i => {
44- const hasId = i .id && document .querySelector (` label[for="${ i .id } "]` );
45- const hasAria =
46- i .getAttribute (' aria-label' ) || i .getAttribute (' aria-labelledby' );
47- const hasImplicitLabel = i .closest (' label' );
48- return ! hasId && ! hasAria && ! hasImplicitLabel;
49- })
50- .map (i => ({
51- tag: i .tagName ,
52- id: i .id ,
53- name: i .name ,
54- placeholder: i .placeholder ,
55- }));
56- }
57- ```
39+ const inputs = Array .from (
40+ document .querySelectorAll (' input, select, textarea' ),
41+ );
42+ return inputs
43+ .filter (i => {
44+ const hasId = i .id && document .querySelector (` label[for="${ i .id } "]` );
45+ const hasAria =
46+ i .getAttribute (' aria-label' ) || i .getAttribute (' aria-labelledby' );
47+ const hasImplicitLabel = i .closest (' label' );
48+ return ! hasId && ! hasAria && ! hasImplicitLabel;
49+ })
50+ .map (i => ({
51+ tag: i .tagName ,
52+ id: i .id ,
53+ name: i .name ,
54+ placeholder: i .placeholder ,
55+ }));
56+ };
57+ ```
58+
59+ ````
5860
59614. Check images for ` alt` text.
6062
@@ -74,10 +76,10 @@ According to web.dev, tap targets should be at least 48x48 pixels with sufficien
7476```javascript
7577// Usage in console: copy, paste, and call with element: fn(element)
7678el => {
77- const rect = el .getBoundingClientRect ();
78- return {width: rect .width , height: rect .height };
79+ const rect = el.getBoundingClientRect();
80+ return {width: rect.width, height: rect.height};
7981};
80- ```
82+ ````
8183
8284_Pass the element' s ` uid` from the snapshot as an argument to the tool ._
8385
@@ -134,20 +136,20 @@ Verify document-level accessibility settings often missed in component testing:
134136```javascript
135137(() => {
136138 const f = () => {
137- return {
138- lang:
139- document .documentElement .lang ||
140- ' MISSING - Screen readers need this for pronunciation' ,
141- title: document .title || ' MISSING - Required for context' ,
142- viewport:
143- document .querySelector (' meta[name="viewport"]' )? .content ||
144- ' MISSING - Check for user-scalable=no (bad practice)' ,
145- reducedMotion: window .matchMedia (' (prefers-reduced-motion: reduce)' )
146- .matches
147- ? ' Enabled'
148- : ' Disabled' ,
139+ return {
140+ lang:
141+ document.documentElement.lang ||
142+ ' MISSING - Screen readers need this for pronunciation' ,
143+ title: document.title || ' MISSING - Required for context' ,
144+ viewport:
145+ document.querySelector(' meta[name= " viewport" ]' )?.content ||
146+ ' MISSING - Check for user- scalable= no (bad practice)' ,
147+ reducedMotion: window.matchMedia(' (prefers- reduced- motion: reduce)' )
148+ .matches
149+ ? ' Enabled'
150+ : ' Disabled' ,
151+ };
149152 };
150- };
151153 try {
152154 console.log(f());
153155 } catch (e) {} // Log for manual console usage
0 commit comments