Skip to content

Commit 138acd5

Browse files
authored
fix: SpreadSheet dark mode display (#1533) & add placeholder example (#1532) (#1564)
* style: fix SpreadSheet dark mode display (#1533) * fix: add placeholder example (#1532)
1 parent eff9148 commit 138acd5

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
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.

src/guide/extras/demos/SpreadSheet.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const cols = cells.map((_, i) => String.fromCharCode(65 + i))
2626

2727
<style scoped>
2828
th {
29-
background-color: #eee;
29+
color: var(--vt-c-text-1);
30+
background-color: var(--vt-c-bg-mute);
3031
padding: 0 1em;
3132
}
3233
@@ -39,7 +40,7 @@ tr:first-of-type th:first-of-type {
3940
}
4041
4142
td {
42-
border: 1px solid #ccc;
43+
border: 1px solid var(--vt-c-bg-mute);
4344
padding: 0;
4445
}
4546
</style>

src/guide/extras/demos/SpreadSheetCell.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function update(e) {
3333
height: 1.5em;
3434
line-height: 1.5;
3535
font-size: 15px;
36+
color: var(--vt-c-text-1);
3637
}
3738
3839
.cell span {
@@ -46,7 +47,7 @@ function update(e) {
4647
}
4748
4849
.cell input:focus {
49-
border: 2px solid blue;
50-
background-color: #fff;
50+
border: 2px solid var(--vt-c-divider);
51+
color: var(--vt-c-text-1);
5152
}
5253
</style>

0 commit comments

Comments
 (0)