Skip to content

Commit ebaa985

Browse files
committed
fix: add placeholder example (#1532)
1 parent 5bd239e commit ebaa985

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/guide/best-practices/accessibility.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,27 @@ Avoid using placeholders as they can confuse many users.
277277

278278
One of the issues with placeholders is that they don't meet the [color contrast criteria](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) by default; fixing the color contrast makes the placeholder look like pre-populated data in the input fields. Looking at the following example, you can see that the Last Name placeholder which meets the color contrast criteria looks like pre-populated data:
279279

280+
```vue-html
281+
<form
282+
class="demo"
283+
action="/dataCollectionLocation"
284+
method="post"
285+
autocomplete="on"
286+
>
287+
<div v-for="item in formItems" :key="item.id" class="form-item">
288+
<label :for="item.id">{{ item.label }}: </label>
289+
<input
290+
type="text"
291+
:id="item.id"
292+
:name="item.id"
293+
v-model="item.value"
294+
:placeholder="item.placeholder"
295+
/>
296+
</div>
297+
<button type="submit">Submit</button>
298+
</form>
299+
```
300+
280301
<!-- <common-codepen-snippet title="Form Placeholder" slug="ExZvvMw" :height="265" tab="js,result" theme="light" :preview="false" :editable="false" /> -->
281302

282303
It is best to provide all the information the user needs to fill out forms outside any inputs.

0 commit comments

Comments
 (0)