Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

app.tsx

137 lines4.5 KB

1import { createSignal } from 'solid-js'
2​
3export default function App() {
4 const [showModal, setShowModal] = createSignal(false)
5​
6 return (
7 <div style="padding: 20px; font-family: system-ui, sans-serif;">
8 <h1>A11y Devtools Demo</h1>
9 <p>
10 This page contains intentional accessibility issues to demonstrate the
11 A11y devtools plugin. Open the devtools panel and click "Run Audit" to
12 see the issues.
13 </p>
14​
15 <section style="margin-top: 24px;">
16 <h2>Accessibility Issues Demo</h2>
17​
18 {/* Issue: Image without alt text */}
19 <div style="margin-bottom: 16px;">
20 <h3>1. Image without alt text</h3>
21 <img
22 src="https://via.placeholder.com/150"
23 width={150}
24 height={150}
25 style="border: 1px solid #ccc;"
26 />
27 </div>
28​
29 {/* Issue: Button without accessible name */}
30 <div style="margin-bottom: 16px;">
31 <h3>2. Button without accessible name</h3>
32 <button style="width: 40px; height: 40px; font-size: 20px;">
33 <span aria-hidden="true">Γ—</span>
34 </button>
35 </div>
36​
37 {/* Issue: Form input without label */}
38 <div style="margin-bottom: 16px;">
39 <h3>3. Form input without label</h3>
40 <input
41 type="text"
42 placeholder="Enter your name"
43 style="padding: 8px;"
44 />
45 </div>
46​
47 {/* Issue: Low color contrast */}
48 <div style="margin-bottom: 16px;">
49 <h3>4. Low color contrast</h3>
50 <p style="color: #aaa; background-color: #fff;">
51 This text has poor color contrast and may be hard to read.
52 </p>
53 </div>
54​
55 {/* Issue: Link without discernible text */}
56 <div style="margin-bottom: 16px;">
57 <h3>5. Link without discernible text</h3>
58 <a href="https://example.com" style="display: inline-block;">
59 <img src="https://via.placeholder.com/24" width={24} height={24} />
60 </a>
61 </div>
62​
63 {/* Issue: Missing main landmark */}
64 <div style="margin-bottom: 16px;">
65 <h3>6. Click handler on non-interactive element</h3>
66 <div
67 onClick={() => setShowModal(true)}
68 style="padding: 12px 24px; background-color: #0ea5e9; color: white; border-radius: 4px; display: inline-block; cursor: pointer;"
69 >
70 Click me (not a button!)
71 </div>
72 </div>
73​
74 {/* Issue: Empty heading */}
75 <div style="margin-bottom: 16px;">
76 <h3>7. Empty heading</h3>
77 <h4></h4>
78 </div>
79​
80 {/* Issue: Missing form labels */}
81 <div style="margin-bottom: 16px;">
82 <h3>8. Select without label</h3>
83 <select style="padding: 8px;">
84 <option>Option 1</option>
85 <option>Option 2</option>
86 <option>Option 3</option>
87 </select>
88 </div>
89 </section>
90​
91 <section style="margin-top: 32px; padding: 16px; background-color: #f5f5f5; border-radius: 8px;">
92 <h2>Accessible Content (for comparison)</h2>
93​
94 <div style="margin-bottom: 16px;">
95 <h3>Proper image with alt text</h3>
96 <img
97 src="https://via.placeholder.com/150"
98 alt="Placeholder image for demonstration"
99 width={150}
100 height={150}
101 style="border: 1px solid #ccc;"
102 />
103 </div>
104​
105 <div style="margin-bottom: 16px;">
106 <h3>Proper button with label</h3>
107 <button
108 aria-label="Close dialog"
109 style="width: 40px; height: 40px; font-size: 20px;"
110 >
111 <span aria-hidden="true">Γ—</span>
112 </button>
113 </div>
114​
115 <div style="margin-bottom: 16px;">
116 <h3>Proper input with label</h3>
117 <label for="name-input" style="display: block; margin-bottom: 4px;">
118 Your Name
119 </label>
120 <input id="name-input" type="text" style="padding: 8px;" />
121 </div>
122 </section>
123​
124 {showModal() && (
125 <div
126 role="dialog"
127 aria-labelledby="modal-title"
128 style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: white; padding: 24px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); z-index: 1000;"
129 >
130 <h2 id="modal-title">Modal Dialog</h2>
131 <p>This is a modal that was triggered by a non-button element.</p>
132 <button onClick={() => setShowModal(false)}>Close</button>
133 </div>
134 )}
135 </div>
136 )