Skip to content

Commit 4c8b2e2

Browse files
authored
feat: enable a datalist example within our documentation (#522)
1 parent 3ab1015 commit 4c8b2e2

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

source/_patterns/01-elements/input/_input.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ We're using the construct of `label` and `input` elements shown below (both thei
1010
- "Generally, explicit labels are better supported by assistive technology." - compare to the [W3C spec](https://www.w3.org/WAI/tutorials/forms/labels/#associating-labels-implicitly), seems to be a [WCAG criteria](https://www.w3.org/TR/WCAG20-TECHS/H44.html) that for, too.
1111
- We could easily control the styling depending on the `input` elements (pseudo-)states w/o the need for JavaScript
1212

13+
## Auto suggestions
14+
15+
You could easily integrate the possibility to provide auto suggestions to your input fields via the [`list`-attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#list) on the `input`-HTML-elements as well as adding the suggestions via the [`datalist`-HTML-element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist). Please follow up within the [Input - Auto Suggestions](/patterns/elements-input-input-auto-suggest/elements-input-input-auto-suggest.rendered.html) section.
16+
1317
## Autofill
1418

1519
For heavily supporting the user on autofilling form fields (not only, but especially on mobile browsing) with information even already available on their devices, you could use the `autocomplete` attribute, as described e.g. here <https://cloudfour.com/thinks/autofill-what-web-devs-should-know-but-dont/>

source/_patterns/01-elements/input/input.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717

1818
width: 100%;
1919

20+
&[list] {
21+
&::-webkit-calendar-picker-indicator {
22+
margin-right: -1rem;
23+
}
24+
}
25+
2026
&:not(:placeholder-shown) {
2127
padding-bottom: 0;
2228
padding-top: to-rem($pxValue: 16);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
22
title: Input - Auto suggestions
3-
tags: [style-1.6]
43
---
4+
5+
You could easily integrate the possibility to provide auto suggestions to your input fields via the [`list`-attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#list) on the `input`-HTML-elements as well as adding the suggestions via the [`datalist`-HTML-element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist).

0 commit comments

Comments
 (0)