Skip to content

Commit da406ac

Browse files
Replaced codepen in Accessibility -> Placeholder with playground link (#1777)
* fix: replaced codepen with playground link * feat: replaced code snippet with the image
1 parent ff0418b commit da406ac

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/guide/best-practices/accessibility.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ 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+
![Accessible placeholder](./images/AccessiblePlaceholder.png)
281+
280282
```vue-html
281283
<form
282284
class="demo"
@@ -298,7 +300,25 @@ One of the issues with placeholders is that they don't meet the [color contrast
298300
</form>
299301
```
300302

301-
<!-- <common-codepen-snippet title="Form Placeholder" slug="ExZvvMw" :height="265" tab="js,result" theme="light" :preview="false" :editable="false" /> -->
303+
```css
304+
/* https://www.w3schools.com/howto/howto_css_placeholder.asp */
305+
306+
#lastName::placeholder {
307+
/* Chrome, Firefox, Opera, Safari 10.1+ */
308+
color: black;
309+
opacity: 1; /* Firefox */
310+
}
311+
312+
#lastName:-ms-input-placeholder {
313+
/* Internet Explorer 10-11 */
314+
color: black;
315+
}
316+
317+
#lastName::-ms-input-placeholder {
318+
/* Microsoft Edge */
319+
color: black;
320+
}
321+
```
302322

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

42.9 KB
Loading

0 commit comments

Comments
 (0)